This is like my 12th post since like 10 days ago lol.
Since I’m new to making combat scripts im trying to innovate on how to make a stun.
The only issue I have is making the stunned player unable to hit.
Im trying to use a remote event to send to the client that It cannot hit anymore
event = game.ReplicatedStorage.Events.Stun
players = game:GetService("Players")
local Stun = {}
function Stun.stun(hum, dur, dmg)
local character = hum.Parent
local player = players:GetPlayerFromCharacter(character)
print(player.Name)
event:FireClient(player, dur)
hum.WalkSpeed = 0
hum:TakeDamage(dmg)
task.wait(dur)
hum.WalkSpeed = 18
end
return Stun
this is the module script.
It prints the name of the hit player, but for some reason regardless I can still hit
I want to help but the information you provided is kinda limited so i need you to answer these questions:
1 - Is the remote event firing at all on the client?
2 - Are you checking that can_hit is equal to true before allowing the player to attack?
3 - When you are calling the stun function, what value are you assigning dur? is it a negative number?
I made sure the event is firing to the player. I havent gone to check if it fires at all thanks.
im using CAS (ContextActionService) so in the functions on the very first line I put
local function punch()
if input_state == Enum.UserInputState.Begin and can_hit then
--code code
end