|
Post by geoboy356 on Jun 24, 2017 21:24:40 GMT
I need help in Roblox Lua Scripting for Animations for somewhat reason i cant play my animation everything else i think is good but my animation wont play im sure of that ive selected the Animations already if you wana help me further my Username is: geoboy356 come to my Game Testing Place if u wana edit it and say whats wrong with it if you wana see the Explorer this is the script:
Sword = script.Parent
local TouchEn = true local Swinging = false local en = true local on = 1 Sword.Activated:connect(function() if en == true then return end local cha = Sword.Parent local hum = cha.Humanoid local anim = hum:LoadAnimation(script.Parent["Animation"..on]) anim:Play() Swinging = true TouchEn = true wait(0.5) --Cooldown on how long you wana swing each time Swinging = false on = on + 1 if on >= 3 then on = 1 wait(1) -- The Cooldown of the Whole Combo end en = true end)
Sword.Handle.Touched:connect(function(hit) if not Swinging then return end if TouchEn == false then return end if hit and hit.Parent:findFirstChild("Humanoid") then TouchEn = false hit.Parent:findFirstChild("Humanoid"):TakeDamage(10) --How much damage you want wait(0.5) --Must be the same as the first CoolDown TouchEn = true end end)
|
|
|
Post by goulstem on Jun 24, 2017 23:24:58 GMT
Any errors mate?
|
|
codexjosh
New Member
Posts: 7
ROBLOX Username: CodexJosh
|
Post by codexjosh on Jul 2, 2017 17:31:02 GMT
I'm not sure what you are attempting to accomplish here? I am looking through your code and I see "if en == true then return end". Why are you returning something before primary assets of the function actually begin?
|
|
|
Post by Bit on Jul 19, 2017 15:00:29 GMT
codexjosh , That is called a debounce, and is therr to make sure it only runs when you want it to run.
|
|