So I am working on a fps game. The game is FE is on and I'm not very familiar with FE. The problem is that when I shoot the weapon and it kills a player it only shows on the Client who killed the player. I have looked at the Roblox Wiki, Youtube videos and some articles about filtering enabled but all of my attempts never work.
Here's what I know: I will probably need a remote event to show all clients that the player took damage/died. I'll also need a script that handles the event when needed.
What should I do?
(Here's part of the framework)
local damage = 30 if hit.Parent:findFirstChild("Humanoid") then hit.Parent:findFirstChild("Humanoid"):TakeDamage(damage) -- Something like this? -- The first argument is the players name that was hit -- The second argument is the damage done game.ReplicatedStorage.KillEvent:FireServer(hit.Parent.Name,damage) end
If I wasn't clear enough, then here's basically an example you can do. In RepStorage, add the remote event called "DamageEvent" and then in ServerScriptService add a global script.
In the global script, write the following:
`local damage = 30
game.ReplicatedStorage.DamageEvent.Fired:Connect(function(hit,damage) if hit.Parent:findFirstChild("Humanoid") then hit.Parent:findFirstChild("Humanoid"):TakeDamage(damage) --AND all the other stuff you have in the local script end end)
`
And then in your local script, change it to
game.ReplicatedStorage.DamageEvent:FireServer(hit,damage)
Oggy forgot to identify the player firing the event in the global script:
game.ReplicatedStorage.DamageEvent.Fired:Connect(function(player, hit, damage) -- the first argument is always the player who fired the remote if hit.Parent:findFirstChild("Humanoid") then hit.Parent:findFirstChild("Humanoid"):TakeDamage(damage) --AND all the other stuff you have in the local script end end)