get paid to paste

Cursed Tank Sim script

local key = "F"

-- IN ORDER TO USE!!!! Hit shift / zoom into the gunner view and then hit the assigned key

local Player = game:GetService("Players").LocalPlayer
local FirstDown = false
local Velocity = 0
local RunService = game:GetService("RunService")
local Cam = game.Workspace.CurrentCamera
_G.Break = false

local function fireBullet(originPoint, velocity)
    local bulletPos, bulletVelocity = originPoint, velocity
    local startTime = tick()
    while true do
        if _G.Break then return end
        if tick() - startTime > 3 then break end
        local dt = RunService.RenderStepped:Wait()

        local bulletRay = Ray.new(bulletPos, bulletVelocity)
        local hitPart, hitPoint, hitNormal = workspace:FindPartOnRay(bulletRay)
        local Tank = game:GetService("Workspace").Vehicles:FindFirstChild("Chassis"..Player.Name)
        if not Tank then break end
        if hitPart and not hitPart:FindFirstAncestor(Tank.Name) then
            if game.Workspace:FindFirstChild("Tracker") then game.Workspace.Tracker:Destroy() end
            local I = Instance.new("Part")
            local Bill = Instance.new("BillboardGui")
            local Text = Instance.new("TextLabel")
            Bill.Parent = I
            Bill.Size = UDim2.new(1,0,1,0)
            Bill.AlwaysOnTop = true
            Text.Parent = Bill
            Text.Size = UDim2.new(1,0,1,0)
            local Dist = nil
            if hitPoint then
                Dist = math.ceil(0.2803 * ((hitPoint - Cam.CFrame.Position).Magnitude) + 0.1310)
                Text.Text = tostring(Dist)
            end
            Text.BackgroundColor3 = Color3.fromRGB(255, 0, 208)
            I.CanQuery = false
            I.CanTouch = false
            I.CanCollide = false
            I.Position = hitPoint
            I.Name = "Tracker"
            I.Parent = game.Workspace
            I.Anchored = true
            I.Transparency = 1
            I.Size = Vector3.new(2,2,2)
            if Dist then
                local Reticle = Player.PlayerGui.hi:FindFirstChildOfClass("Frame")
                if Reticle:FindFirstChild("Frame") then
                    if Reticle:FindFirstChild("Tracker") then Reticle.Tracker:Destroy() end
                    local x,y = nil,nil
                    local Copy = nil
                    for i,v in pairs(Reticle:GetChildren()) do
                        if v:FindFirstChild("TextLabel") then
                             if v.TextLabel.Text == "2" then
                                 x = v.TextLabel.AbsolutePosition.Y
                                 Copy = v
                                 if y then break end
                             elseif v.TextLabel.Text == "4" then
                                 y = v.TextLabel.AbsolutePosition.Y
                                 if x then break end
                            end
                        end
                    end
                    local C = Copy:Clone()
                    C.Parent = Copy.Parent
                    C.Name = "Tracker"
                    C.BackgroundColor3 = Color3.fromRGB(255, 0, 208)
                    C.Position = UDim2.new(.5,0,.5,(Dist/200) * (y-x))
                    C.TextLabel.Text = Dist / 100
                    C.TextLabel.TextColor3 = Color3.fromRGB(255, 0, 208)
                end
            end            
            break
        else
            bulletVelocity = bulletVelocity - (Vector3.new(0, game.Workspace.Gravity, 0) * dt)
            bulletPos = bulletPos + bulletVelocity * dt
        end
    end
end

function main(act, state, obj)
  if state == Enum.UserInputState.Begin then
    if not FirstDown then
        FirstDown = true
        for i,v in pairs(Player.PlayerGui["Shell Selector Gui"].FrameBox:GetChildren()) do
            if v:FindFirstChild("Frame") and v.BackgroundColor3 == Color3.fromRGB(255, 155, 0) then
                for a,b in pairs(v.Frame:GetChildren()) do
                    if b:FindFirstChild("val") and string.match(b.val.Text,"%d+m/s") then
                        Velocity = tonumber(string.match(b.val.Text,"(%d+)m/s")) * 10
                    end
                end
            end
        end
        task.spawn(function()
            while FirstDown do
                wait(.1)
                Cam = game.Workspace.CurrentCamera
                print(Cam.CFrame.LookVector)
                task.spawn(fireBullet,Cam.CFrame.Position,Velocity * Cam.CFrame.LookVector)
                if _G.Break then FirstDown = false return end
            end
            _G.Break = true
            wait(.5)
            if game.Workspace:FindFirstChild("Tracker") then game.Workspace.Tracker:Destroy() end
            _G.Break = false
        end)
    end
  else
    FirstDown = false
  end
end

local CAS = game:GetService("ContextActionService")
CAS:UnbindAction("BoundAction")
CAS:BindAction("BoundAction", main, false, Enum.KeyCode[key])

Pasted: Mar 12, 2023, 1:05:12 am
Views: 999