I'm making a stun system in my game, and I have run into a problem with starting a function in a local script from a module script.
The first part probably isn't all that important, its just a remote event sending into the module script. The problem is on the module script. code :
function Attacking.Kick(HumanoidRootPart) print("got the startup function") -- script.Parent.PunchDamage.Punch() if(HumanoidRootPart == nil) then return end local overlapParams = OverlapParams.new() local hitContents = workspace:GetPartBoundsInBox(HumanoidRootPart.CFrame*CFrame.new(0, 0, -5),Vector3.new(5, 6, 4), overlapParams) local hitList = {} for i,v in pairs(hitContents) do local e_character = v.Parent local c_humanoid = e_character:FindFirstChild("Humanoid") if(c_humanoid) then if not hitList[e_character] then hitList[e_character] = true local PunchSound = script.Parent.punch5 wait(0.15) PunchSound:Play() c_humanoid:TakeDamage(50) --heres the problem c_humanoid.FightManager.SentStun(1.5) end end end end
The main reason why I do this is because of a variable of the stun I need to set to prevent the player from using any move sets.
Hello, linkad1!
First of all, I'm not really sure what you mean by 'Module Script', as they can't be triggered directly by Remote Events. I'll assume you recive the event on a script and from there you invoke the function on the module.
When you trigger a function on a mudule script, its just like you are triggering it on the same script.
So, if you are triggering that module from the client-side, use a Bindable Function. If you are triggering the module from server-side, use a Remote Event.
If this answers your question, please mark it as the 'Accepted Answer'