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

My TP Pad does not work and always gives me this error message?! Help Please!

Asked by 3 years ago
Edited 3 years ago

Why does my TP Pad not work? It keeps saying "Workspace.Level1.TP LvL 1 - LvL 2.Script:8: invalid argument #1 to 'new' (Vector3 expected, got Instance) - Server - Script:8".

This is the script:

local db = false local dbwait = 5

script.Parent.Touched:Connect(function(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) and db == false then local Root = hit.Parent:FindFirstChild("HumanoidRootPart")

    Root.CFrame = CFrame.new(workspace.Level1["TP LvL 2 - LvL 1"])
    db = true
    wait(dbwait)
    db = false
end

end)

Thank you, Please Help.

1 answer

Log in to vote
0
Answered by
MattVSNNL 620 Moderation Voter
3 years ago

Try this

local tpPart = workspace:FindFirstChild("TPPart") --  The location of your teleport part
local cooldown = false

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        if cooldown == false then
            cooldown = true

            hit.Parent:FindFirstChild("HumanoidRootPart").CFrame = tpPart.CFrame

            wait(3) -- Cooldown time

            cooldown = false

        end
    end
end)
Ad

Answer this question