i am try to make make it so when a player is touching a certain object, the player jumps backwards but the script I made is only making the player jump.
damagePlane = script.Parent function damage(hit) local partParent = hit.Parent local humanoid = partParent:FindFirstChild("Humanoid") local player = game:GetService("Players"):GetPlayerFromCharacter(partParent) local character = player.Character local rootPart = player.Character:FindFirstChild("HumanoidRootPart") local direction = rootPart.CFrame + rootPart.CFrame.LookVector if player then humanoid.Jump = true player:Move(-direction, false) end end damagePlane.Touched:Connect(damage)
You mean knockback right?
script.Parent.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then if not humanoid.Parent.Torso:FindFirstChild("VectorForce") then local VectorForce = Instance.new("VectorForce") local Attachment = Instance.new("Attachment") VectorForce.Parent = humanoid.Parent.Torso Attachment.Parent = humanoid.Parent.Torso VectorForce.Force = Vector3.new(0,300,6000) ---You might need to change this VectorForce.Attachment0 = Attachment VectorForce.ApplyAtCenterOfMass = true humanoid.Jump = true game:GetService("Debris"):AddItem(VectorForce,0.5) game:GetService("Debris"):AddItem(Attachment,0.5) end end end)