Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm making a super smash bros game but something isn't right. How to fix it?

Asked by 1 year ago

I'm adding the combat/knockback system. I made this script: function punched() script.Parent.Parent:WaitForChild("RightHand").Touched:Connect(function(hit) if hit.Parent.Humanoid ~= nil then local vf = Instance.new("VectorForce") local at = Instance.new("Attachment") vf.Parent = hit.Parent:WaitForChild("HumanoidRootPart") vf.Force =
script.Parent.Parent:WaitForChild("HumanoidRootPart").CFrame.LookVector * 500 at.Parent = vf.Parent vf.Attachment0 = at vf.RelativeTo = Enum.ActuatorRelativeTo.World hit.Parent.Humanoid.PlatformStand = true wait(0.1) hit.Parent.Humanoid.PlatformStand = false vf:Destroy() at:Destroy() script.Parent.ActivateScript.Enabled = true end end) end script.Parent.Punched.Event:Connect(punched) And here is the 2nd script: local canpunch = true function activated() if canpunch == true then canpunch = false script.Parent.Parent:WaitForChild("RightHand").CanTouch = false script.Parent.Punched:Fire() script.Enabled = false wait(0.5) canpunch = true script.Parent.Parent:WaitForChild("RightHand").CanTouch = true end end script.Parent.Activated:Connect(activated) I also added a BindableEvent called Punched But when I activate the tool it first works good, but after, when I touch a character even without activating the tool it still knocks the character back but with much more force. How to fix this?

0
Make sure you put code in code block by clicking the Lua icon 666_brithday 103 — 1y
0
Oh ok I am new in this scripting helpers Dadeyom 0 — 1y

Answer this question