0% found this document useful (0 votes)
17 views3 pages

message (4)

The document contains a Lua script for a game that sets up various player settings, including key bindings and game-specific configurations. It features a targeting system that allows players to aim at other characters and includes a teleportation function for tools when a specific key is pressed. The script also utilizes drawing functions to visually indicate the target and updates based on player input and game events.

Uploaded by

asdas4a4d4s4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

message (4)

The document contains a Lua script for a game that sets up various player settings, including key bindings and game-specific configurations. It features a targeting system that allows players to aim at other characters and includes a teleportation function for tools when a specific key is pressed. The script also utilizes drawing functions to visually indicate the target and updates based on player input and game events.

Uploaded by

asdas4a4d4s4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

getgenv().

Settings = {
Enabled = true,
Key = Enum.KeyCode.Q,
Prediction = 0.147823234,
HitPart = "HumanoidRootPart",
Argument = "UpdateMousePosI",
Resolver = true,
Universal = true, -- New feature to control universal settings
BulletTP = false -- Feature to enable Bullet Teleportation, BTW can you make it
so when I press M it'll do the bullet TP and m again to turn it off
}

Settings = getgenv().Settings

--// Services \\--


local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

--// Drawing \\--


local DotCircle = Drawing.new("Circle")
DotCircle.Visible = true
DotCircle.Filled = true
DotCircle.Radius = 5
DotCircle.Thickness = 1.25
DotCircle.Color = Color3.new(1, 1, 1)

--// Variables \\--


local Client = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local Character = Client.Character
local Mouse = Client:GetMouse()
local Target = nil

--// Game Settings \\--


local Games = {
[14412355918] = {Name = "Da Downhill", Arg = "MOUSE", Remote = "MAINEVENT"},
[14412601883] = {Name = "Hood Bank", Arg = "MOUSE", Remote = "MAINEVENT"},
[14412436145] = {Name = "Da Uphill", Arg = "MOUSE", Remote = "MAINEVENT"},
[14487637618] = {Name = "Da Hood Bot Aim Trainer", Arg = "MOUSE", Remote =
"MAINEVENT"},
[14413712255] = {Name = "Hood Aim", Arg = "MOUSE", Remote = "MAINEVENT"},
[15186202290] = {Name = "Da Strike", Arg = "MOUSE", Remote = "MAINEVENT"},
[16469595315] = {Name = "Del Hood Aim", Arg = "MOUSE", Remote = "MainEvent"},
}

--// Utility Functions \\--


local function calculateCFrameOffset()
-- Return the fixed offset (0, -1, 0, 1) for teleporting
return CFrame.new(0, -1, 0)
end

local function teleportTool(tool)


if not (Target and Target.Character) then return end
if Settings.BulletTP then
-- Store the original grip to restore it after teleportation
local originalGrip = tool.Grip
local characterRightHand = Client.Character.RightHand
-- Temporarily move the tool to the backpack
tool.Parent = Client.Backpack

-- Temporarily disable anchoring for proper grip adjustment


characterRightHand.Anchored = false
-- Apply the fixed offset (0, -1, 0)
tool.Grip = characterRightHand.CFrame * calculateCFrameOffset()

-- Re-enable anchoring and re-parent the tool back to the character


characterRightHand.Anchored = true
tool.Parent = Client.Character

-- Restore the original grip after the teleportation


tool.Grip = originalGrip
tool.Parent = Client.Backpack
end
end

--// Main Code \\--

GetClosestToMouse = function()
local Target, Closest = nil, 1 / 0

for _, v in pairs(Players:GetPlayers()) do
if (v.Character and v ~= Client and
v.Character:FindFirstChild("HumanoidRootPart")) then
local Position, OnScreen =
Camera:WorldToScreenPoint(v.Character.HumanoidRootPart.Position)
local Distance = (Vector2.new(Position.X, Position.Y) -
Vector2.new(Mouse.X, Mouse.Y)).Magnitude

if (Distance < Closest and OnScreen) then


Closest = Distance
Target = v
end
end
end
return Target
end

UpdateDrawing = function()
local Vector3Pos = Target.Character[Settings.HitPart].Position +
Target.Character[Settings.HitPart].Velocity * Settings.Prediction
local ViewportPos = Camera:WorldToViewportPoint(Vector3Pos)
local MainPos = Vector2.new(ViewportPos.X, ViewportPos.Y)

DotCircle.Position = MainPos
end

local oldpos
local function RecalVel(player, delta)
if player and player.Character and
player.Character:FindFirstChild("HumanoidRootPart") then
local currentPosition = player.Character.HumanoidRootPart.Position
local velocity
if oldpos then
velocity = (currentPosition - oldpos) / delta
oldpos = currentPosition
else
oldpos = currentPosition
end
return velocity
end
end

UserInputService.InputBegan:Connect(function(Input, gameProcessedEvent)
if gameProcessedEvent then return end

if Input.KeyCode == Settings.Key and Settings.Enabled then


if Target == nil then
Target = GetClosestToMouse()
else
Target = nil
end
end
end)

RunService.Heartbeat:Connect(function(Delta)
if Target and Target.Character then
if Settings.Resolver then
Target.Character[Settings.HitPart].Velocity = RecalVel(Target, Delta)
end
UpdateDrawing()
else
DotCircle.Position = Vector2.new(9999, 9999)
end
end)

local function CharAdded()


Character.ChildAdded:Connect(function(tool)
if tool:IsA("Tool") then -- add a better check for if the tool is a weapon
tool.Activated:Connect(function() -- no :Disconnect lol
local gameId = game.PlaceId
local gameSettings = Games[gameId]
local arg = Settings.Universal and (gameSettings and
gameSettings.Arg or Settings.Argument) or Settings.Argument

if Target ~= nil then


game:GetService("ReplicatedStorage")[gameSettings and
gameSettings.Remote or "MainEvent"]:FireServer(arg,
Target.Character[Settings.HitPart].CFrame.Position +
(Target.Character[Settings.HitPart].Velocity * Settings.Prediction))
teleportTool(tool) -- Adding BulletTP functionality
end
end)
end
end)
end

Client.CharacterAdded:Connect(function(newchar)
Character = newchar
CharAdded()
end)

CharAdded()

You might also like