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

Teleport all players help?

Asked by 8 years ago

So I Made a script that teleports all players, It works in a button in a gui as a script (not local script). Howerver when i put it in a script in the Workspace It just doesnt teleport me

The working one

target = CFrame.new(-7.349, 0.5, -48.287)

function tele()
    for i, player in ipairs(game.Players:GetChildren()) do
    player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
end
end

script.Parent.MouseButton1Down:connect(tele)

The non working one

target = CFrame.new(-7.349, 0.5, -48.287) 

function tele()
    for i, player in ipairs(game.Players:GetChildren()) do
    player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
end
end

game.Players.PlayerAdded:connect(tele)

I would like it to teleport all players when a NumberValue is = 1, the Value is locaed at game.Workspace.Basics.Map

Thanks for any help :)

0
You would want to use the changed event then determine if the value the property has changed to was 1. Please make an attempt at creating this format of the script. M39a9am3R 3210 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Value.Changed
What did I miss?

The event for when a NumberValue changes has the form of

NumberValue.Changed >> (
    number NewValue
);

Which means for you that you can connect to the Changed event of workspace.Basics.Map and check if your NewValue == 1

0
Umm im not so sure how to work that as it gives me an error and im not sure how to go forward with that AuthenticOakChair 68 — 8y
Ad

Answer this question