Hello, I need help with an upcoming sword fighting game I'm making. Right now, I am working on the combat system. It is based around a number, which we will call buildup. Buildup starts at 21 and goes down by 2 each time you get hit. When it reaches a number lower than 7, you will get stunned. Right now I am working on the main part, getting stunned. I have yet to work on the hit detection, but if you look in the script, I can change a value so that it would simulate a hit (The value would go down). Anyway, while testing the script, it did not seem to work at all. Even though there were no errors in the output. I am very VERY new to scripting and would like all the help I can get (well I'm not forcing you but, you get it). Thanks in advance.
local buildup = script.Parent
local hum = script.Parent.Parent.Parent:FindFirstChild("Humanoid")
stunned = false
if buildup.Value <= 7 then
if stunned == false then
stunned = true
print("epic")
local StunAnim = hum:LoadAnimation(script.Parent.StunAnim)
StunAnim:Play()
hum.WalkSpeed = 0
if stunned == true then
wait(5)
stunned = false
StunAnim:Stop()
hum.WalkSpeed = 16
buildup.Value = 21
end
end
end

1 comment
Thanks for the answer, but can you be a bit more specific about where I would use a remote event?