|
| 13 Mar 2016 09:07 PM |
So I've got an animation that works great, until the player selects the tool. Meaning, if they dropped the tool and picked it up again, when you pick up, it's automatically selected. It works perfectly then, but when the player deselects the tool and reselects it, then things get buggy, weird, studdery, etc. It almost looks like the script was run twice in one click. Can someone tell me if this is ROBLOX or my script, and possible ways to fix this?
local tool = script.Parent local num = 0.005 script.Parent:WaitForChild("CoolDown") local x = script.Parent:FindFirstChild("CoolDown") local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() tool.GripUp = Vector3.new(0, 1, 0) function onActivation() if x.Value == 0 then x.Value = 1 tool.GripUp = Vector3.new(0, 1, 0) wait(num) tool.GripUp = Vector3.new(0.243, 0.97, 0) wait(num) tool.GripUp = Vector3.new(0.447, 0.894, 0) wait(num) tool.GripUp = Vector3.new(0.6, 0.8, 0) wait(num) tool.GripUp = Vector3.new(1, 0, 0) if mouse.Target and mouse.Target.Parent:FindFirstChild("Tree") then mouse.Target.Parent:WaitForChild("Health") local hp = mouse.Target.Parent:FindFirstChild("Health") hp.Value = hp.Value - 10 end wait(0.25) tool.GripUp = Vector3.new(0.6, 0.8, 0) wait(num) tool.GripUp = Vector3.new(0.447, 0.894, 0) wait(num) tool.GripUp = Vector3.new(0.243, 0.97, 0) wait(num) tool.GripUp = Vector3.new(0, 1, 0) wait(0.75) x.Value = 0 end end tool.Activated:connect(onActivation)
--//
~MightyDantheman |
|
|
| Report Abuse |
|
|
| 13 Mar 2016 09:11 PM |
You can test it out for yourself in the game (while it's open):
http://www.roblox.com/games/331783664/Survival-Game-Test
~MightyDantheman |
|
|
| Report Abuse |
|
| |
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 09:43 PM |
debounces are useful you know
|
|
|
| Report Abuse |
|