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

Value only clones to one person in the server?

Hello.

I am currently trying to make a very simple script that clones a value into a player's character. This works, however, it only clones to one player. I'm unsure why this is caused. Here's the script:

local Value = Instance.new("BoolValue")
Value.Name = "IsTeleporting"

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		Value.Parent = Character
	end)
end)

I am unsure why this is happening, and would like some help. Thanks!

1 answer

✓ Accepted answer

You have done nearly everything correct, however you've forgotten to Clone the value. You are moving the value to the first player who's character loads, instead of replicating it.

local Value = Instance.new("BoolValue")
Value.Name = "IsTeleporting"

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        Value:Clone().Parent = Character
    end)
end)

3 comments

1

Ah my bad! These errors slip past! Thanks!

0

Also, congratulations on 1000 Reuptation!

0

Thank you! Happy Holidays!

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