I wrote this script up but due to some circumstances I can't test it in studio. I'm almost certain there is an error in this, since I'm not too great of a scripter. Can anyone help me Debug this? It's supposed to e in a local script in a tool. When the player presses r it does the actual function of cloning a model and playing an animation.
--Normal variable setup local player = game.Players.LocalPlayer local char = player.Character local debounce = false local stamina = 20 --Setting up the animation local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=?????????" local animTrack = player.Humanoid:LoadAnimation(animation) --Context Action Service local CAS = game:GetService("ContextActionService") --Actual function I want to happen function firewall() if debounce or stamina <= 7 then return end stamina - 7 local CF = game.ServerStorage.Wall:Clone() CF.Parent = script.Parent CF.MainPart.Position = char.Torso.Position + Vector3.new(5,0,0) CF.MainPart.Rotation = char.Torso.Rotation animTrack:Play() debounce = true wait(5) debounce = false end script.Parent.Equipped:connect(function() CAS:BindActionToInputTypes("wall", firewall, false, "r") end end) script.Parent.UnEquippedd:connect(function() CAS:UnbindAction("wall") end end)
Thanks