Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make the pad go with the give and how to add more positions?

Asked by 3 years ago

I'm having trouble making a pad teleport with the give and creating more positions to go with it. This is the script for the pad that I've been trying to get to work:

while true do
    script.Parent.Position = script.Parent.Parent.Give.Vector3.new(0, -3, 0)
    wait(0.001)
end

Here's the script for the give:

local randomValue
local position1 = Vector3.new(-66.32, 5.572, -92.15)--(-66.91 -100.99)
local position2 = Vector3.new(-66.32, 5.572, -106.94)--(-66.91 -100.99)

script.Parent.Touched:Connect(function(Hit)

    randomValue = math.random(1,2)
    local player = game.Players:GetPlayerFromCharacter(Hit.Parent.Parent)
    print(Hit.Parent.Name)
    local char = Hit.Parent
    if Hit.Name == 'JobBox' then
        print('BOXHIT')
        script.Parent.Parent.Anim.Value = 'false'
        script.Parent.Parent.Taken.Value = 'false'
        player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 2
        Hit:Destroy()
        script.Parent.Parent.AnimScript.Disabled = true
        script.Parent.Parent.AnimScript.Disabled = false

        if randomValue == 1 then

            script.Parent.Position = position1

        else

            script.Parent.Position = position2

        end
    end
end)

Answer this question