|
| 02 Oct 2014 04:08 PM |
Help when i test my game i try swinging it wont swing can you help
SWORD MAIN SCRIPT --Made By Joeyluu999 RobloxU-- local sp = script.Parent local Mspeed = 1.25 local handle = sp:WaitForChild("Handle") local event = sp:WaitForChild("REvent") local slashsound = handle:WaitForChild("SlashSound") local thrustsound = handle:WaitForChild("OverheadSound") local overheadsound = handle:WaitForChild("LungeSound") local hithumanoids = {} local damage = 25 local lastclick = 0 local slashtime = 1 local Cwindowing = .5 local combo = 0 handle.Touched:connect(function(hit) if equipped and characters and humanoid and humanoid.Health > 0 and hit and not hit:isDescendantOf(characters) then local targethumanoid = hit.Parent:FindFirstChild("Humanoid") if targethumanoid and targethumanoid.Health > 0 and not hithumanoids[targethumanoid] then hithumanoids[targethumanoid] = true targethumanoid:TakeDamage(damage) targethumanoid:TakeDamage(damage * combo) end end end) sp.Activated:connect(function() local clickdelta = tick() - lastclick if clickdelta < slashtime then lastclick = tick() hithumanoids = {} if clickdelta > slashtime + Cwindowing then combo = (combo + 1)%3 else combo = 0 end if player then if combo == 0 then event:FireClient(player, "RunAnimation","AnSlash2") slashsound:Play() elseif combo == 1 then event:FireClient(player, "RunAnimation","AnThrust2") thrustsound:Play() elseif combo == 2 then event:FireClient(player, "RunAnimation","AnOverhead2") overheadsound:Play() end end end
end) sp.Equipped:connect(function() equipped = true; lastclick = tick() characters = sp.Parent player = game.Players:GetPlayerFromCharacter(characters) humanoid = characters:FindFirstChild("Humanoid") if humanoid then humanoid.WalkSpeed = humanoid.WalkSpeed * Mspeed else charcater = nil end
end) sp.Unequipped:connect(function() equipped = false; if humanoid then humanoid.WalkSpeed = humanoid.WalkSpeed / Mspeed else charcater = nil humanoid = nil end end) SWORD LOCAL SCRIPT --Made By Joeyluu999 RobloxU-- local sp = script.Parent local event = sp:WaitForChild("REvent") event.OnClientEvent:connect(function(...) local tuple = {...} if tuple{1} == "RunAnimation" then local anima = sp:FindFirstChild(tuple{2}) if anima and humanoid then local loadanima = humanoid:LoadAnimation(anima) if loadanima then loadanima:Play() if mouses then mouses.Icon = "rbxasset://textures\\GunWaitCursor.png" wait(1) mouses.Icon = "rbxasset://textures\\GunCursor.png" end end end end end) sp.Equipped:connect(function(mouse) local anima = sp:FindFirstChild("AnEquip5") mouses = mouse local character = sp.Parent humanoid = character:FindFirstChild("Humanoid") if humanoid then local anima = sp:FindFirstChild("AnIdle5") if anima and humanoid then if LoadIdleAnima then LoadIdleAnima:Stop() end LoadIdleAnima = humanoid:LoadAnimation(anima) if LoadIdleAnima then LoadIdleAnima:Play() end end local anima = sp:FindFirstChild("AnEquip5") local LoadIdleAnima = humanoid:LoadAnimation(anima) if LoadIdleAnima then LoadIdleAnima:Play() end end if mouses then mouses.Icon = "rbxasset://textures\\GunCursor.png" end end)
sp.Unequipped:connect(function() if LoadIdleAnima then LoadIdleAnima:Stop() end end)
also if you need anything else reply |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 14 Oct 2014 09:07 PM |
Suggestion: Don't ask others to debug your broken code without giving a hint what sort of problem you are having. Posting a few hundred lines of code, saying "it doesn't work", will get you ignored. Posting a dozen lines of code, saying "after line 7 I was expecting to see (something), but (something else) happened instead" is much more likely to get you a reply.
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Oct 2014 10:40 PM |
| im no expert but, try adding wait(2) after the animation plays. |
|
|
| Report Abuse |
|
|