What do you want to achieve? Keep it simple and clear!
I want to make a simple rope swinging mechanic using rope constraints to my parkour game.
What is the issue? Include screenshots / videos if possible!
Every time I try to land on a surface, I get tripped/flung. robloxapp-20201125-1542291.wmv (3.8 MB)
(Sorry for the horrible video quality)
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried disabling some humanoid state types like ragdoll and fallingdown and adding body gyros.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local ProximityPrompt = script.Parent.ProximityPrompt
local stateType = Enum.HumanoidStateType
local RunService = game:GetService("RunService")
ProximityPrompt.Triggered:Connect(function(player)
local character = workspace:FindFirstChild(player.name)
local humanoid = character:WaitForChild("Humanoid")
local rarm = character:FindFirstChild("Right Arm")
if character and rarm then
local isswinging = character:WaitForChild("IsSwinging")
isswinging.Value = true
local distancebetween = (rarm.Position - script.Parent.Position).Magnitude
local antifling = Instance.new("BodyGyro", character:FindFirstChild("HumanoidRootPart"))
antifling.MaxTorque = Vector3.new(0,0,0)
antifling.P = 5000
antifling.D = 500
humanoid:SetStateEnabled(stateType.FallingDown, false)
humanoid:SetStateEnabled(stateType.Ragdoll, false)
--humanoid:SetStateEnabled(stateType.Running, false)
--humanoid:SetStateEnabled(stateType.Landed, false)
--humanoid:SetStateEnabled(stateType.Freefall, false)
local att0 = Instance.new("Attachment", rarm)
local att1 = Instance.new("Attachment", script.Parent)
att1.Name = player.Name
local rope = Instance.new("RopeConstraint", rarm)
rope.Attachment1 = att1
rope.Attachment0 = att0
rope.Length = distancebetween
rope.Visible = true
rope.Restitution = 1
humanoid.StateChanged:Connect(function(oldstate, newstate)
if isswinging.Value == true and newstate == Enum.HumanoidStateType.Running or newstate == Enum.HumanoidStateType.Landed then
isswinging.Value = false
end
end)
isswinging.Changed:Connect(function(NewValue)
if NewValue == false then
rope:Destroy()
att0:Destroy()
att1:Destroy()
end
end)
end
end)