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

How come this script teleports everyone? Not just the one clicking it?

Asked by 3 years ago

This script below teleports everyone in the server to the block. Is there a way I can fix that. Post the script below if you figured it out.

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        local ProximityPrompt = script.Parent

        ProximityPrompt.Triggered:Connect(function(player)
            char:MoveTo(workspace.teste.Position) -- changed teste to the name of your brick
        end)
    end)        
end)

0
Are you using "plr" or "player" you have both. Without defining the player,  ProximityPrompt is being triggered by everyone.  ABK2017 406 — 3y

1 answer

Log in to vote
0
Answered by
Jo1nts 134
3 years ago

I don't think you need the player added event in there try this:

local ProximityPrompt = script.Parent

ProximityPrompt.Triggered:Connect(function(player)
    local char = player.Character.Humanoid
    char:MoveTo(workspace.teste.Position) 
end)
Ad

Answer this question