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

Why is this firing for multiple players?

Problem fixed, thanks for all the replies

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(char)
		local tool = game.ReplicatedStorage.Tools.Revolver:Clone()
		tool.Parent = char
	end)
end)

This is, for whatever reason, giving multiple players the revolver whenever a player spawns. Anyone know why?

3 comments

0

I think everyone is out of ideas, maybe having a few lines to print and open up developer console.

0

Well, I started printing through stuff, and I realized that it was because whenever someone would spawn, a LocalScript would fire a RemoteEvent, which I accidentally set up to trigger this. This is now fixed.

0

I think I deleted the part about the RemoteEvent when I was copying and pasting, so nobody would have known about that. Thanks for all the help, though. :D

4 answers

Try this!

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:wait()
game.ReplicatedStorage.Tools.Revolver:Clone().Parent = player.Backpack
game.ReplicatedStorage.Tools.Revolver:Clone().Parent = player.StarterGear
    end)

4 comments

0

This will only give out the tool the first time the player spawns, and never after that.

0

right, so you could simply clone the tool again, and add it to the StarterGear also.

0

This isn't going to work, I made my own system for equipping tools (I really don't like the built-in one :P ). Thanks, though!

0

No problem!

http://wiki.roblox.com/index.php?title=CharacterAdded_(Event) it clearly states that it changes ALL the peoples walkspeed to 25 in their example, that is why

7 comments

0

That's their example script...

0

its the exact same thing with a different middle noob

1

Excuse me sir, I do not believe I insulted you. The event itself does not change people's speed to 25 like you stated in your answer, the thing is a event that just fires a portion of the script, nothing else.

0

No... mine clones the tool into ONLY the character that was added, or it is supposed to, at least. Theirs changes everyone's player (on purpose).

0

actually just tested your script, it works fine for me, also the reason i called u noob @m39 is cuz i thot u minus repped me for trying to help

0

Well I did minus rep, the you stated that the event would change your speed regardless if you removed the line or not. Here I'll recall it.

0

thanks, sorry for the outburst xd

This script, in itself should not make the problem that you stated occurs. Is this the whole script? And as was previously stated, are you sure you don't have multiple like scripts running?

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