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

Why is this firing for multiple players?

Asked by 10 years ago

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?

0
I think everyone is out of ideas, maybe having a few lines to print and open up developer console. M39a9am3R 3210 — 10y
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. MightyWanderer 30 — 10y
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 MightyWanderer 30 — 10y

4 answers

Log in to vote
0
Answered by
Merely 2122 Moderation Voter Community Moderator
10 years ago

Do you have multiple copies of the script running?

0
Nope. MightyWanderer 30 — 10y
Ad
Log in to vote
0
Answered by
TopDev 0
10 years ago

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)

0
This will only give out the tool the first time the player spawns, and never after that. Merely 2122 — 10y
0
right, so you could simply clone the tool again, and add it to the StarterGear also. TopDev 0 — 10y
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! MightyWanderer 30 — 10y
0
No problem! TopDev 0 — 10y
Log in to vote
0
Answered by 10 years ago

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

0
That's their example script... M39a9am3R 3210 — 10y
0
its the exact same thing with a different middle noob Durfungus 5 — 10y
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. M39a9am3R 3210 — 10y
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). MightyWanderer 30 — 10y
View all comments (3 more)
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 Durfungus 5 — 10y
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. M39a9am3R 3210 — 10y
0
thanks, sorry for the outburst xd Durfungus 5 — 10y
Log in to vote
0
Answered by 10 years ago

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?

Answer this question