Why does the gun only work for one player?

i am trying to make an fps game and it works fine when im the only player in the game but when someone else joins the gun only lets one of the players shoot?

code: framework · paste.gg

What does the server script look for the remote event like? The issue might be in there

1 Like

ev1 · paste.gg fired event

gunrst · paste.gg gun store,

The issue may lie in the gun store script.

I have a question, why is the following code necessary?

if Player.Name == script.Parent.Parent.Parent.Parent.Name then

You could just make the remote event part of the player’s backpack and fire them from there and only the local player will receive those events because of replication. (Everything in StarterPack gets replicated differently per player)

This is most likely the issue because the scripts check that the player who fired the remote must be part of the local player.

example:

-- local script in backpack

local remote = script.Parent:WaitForChild("RemoteEvent")
remote:FireServer()
-- server script also in backpack

local remote = script.Parent:WaitForChild("RemoteEvent")

remote.OnServerEvent:Connect(function(player)
   print(player) -- this would only print the local player and no one else
end)
2 Likes

thank you so much :slight_smile: