Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Teleport all players help?

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 :)

1 comment

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.

1 answer

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

1 comment

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

This discussion is preserved as it was. New answers, comments, and votes are closed.