Confusion on making client created properties show on all clients

I’m attempting to make a stun system for my game using module scripts for maximum flexibility.

However i quickly realized that when i use module scripts and create my stun Boolean it only appears on the attackers client, making it so that the receiver will never be stunned on his side.

You can store all your functions in a modulescript and then use a serverscript to call those functions.

--ModuleScript
local moduleScript = {}

moduleScript.Stun = function()
    --Stun logic
end

return moduleScript
--serverScript
local moduleScript = require(scriptLocation)

event.OnServerEvent:Connect(moduleScript.Stun);
1 Like

Im getting a problem where it changes the person i hit to be the character that initiated the swing

The server already knows which client the FireServer is coming from, so you don’t need the player parameter, so the server thinks there’s 3 parameters when you’ve only given it 2. Try change it to

StunRemote:FireServer(Hit)

I found a fix but its very strange. Basically i have to only fire with the hit parameter and then use the player and hit parameter on the server side. If i only use the hit parameter on the server side then it just returns my own character. Do you know why this is?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.