Help for an script

Hello, I’am devloving a game and I need get a script for when u click to a part it tp to u to other part, I done one but it isn’t working
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I

: mines: (function onClicked()
local p = game.Players:GetChildren()
for i = 1, #p​ do
p[i].Character:MoveTo(Vector3.new(-508.431, 1.3, -307.572))—Put here the positon :slight_smile:
then
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Works with click detector.

I need help because if not I cant do good something, please, help.

1 Like

Just ummm gonna tidy up your code:

local function onClicked()
    local Players = game.Players:GetPlayers()
    for _, Player in pairs(Players) do
        if Player.Character then
            Player.Character:MoveTo(Vector3.new(-508.431, 1.3, -307.572))
        end
    end
end

script.Parent.ClickDetector.MouseClick:Connect(onClicked)

Unless if there’s more to that…?

1 Like

Ill try it for see if it works, and no, theres no more code.

1 Like

Thanks u very munch, It works now.

2 Likes