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

trying to make a place teleport gui but doesnt work, help?

Asked by 6 years ago
script.Parent.Parent.ImageButton.MouseButton1Click:connect(function(click)
    if click.Parent:FindFirstChild("Humanoid") ~= nil then
        game:GetService("TeleportService"):Teleport(script.Parent.ID.Value, game.Players[click.Parent.Name])
        wait (10)
    end
end)

When I use this it tells me "Attempt to index local 'click' (a nil value)" Any help?

1 answer

Log in to vote
0
Answered by
Elixcore 1337 Moderation Voter
6 years ago
plr = game.Players.LocalPlayer

script.Parent.Parent.ImageButton.MouseButton1Click:connect(function()
    if plr.Character:FindFirstChild("Humanoid") then
        game:GetService("TeleportService"):Teleport(script.Parent.ID.Value, plr)
        wait (10)
    end
end)

this should work in a localscript, if it's a serverscript it won't work

0
thank you man SirTottenhamcake 22 — 6y
Ad

Answer this question