[pls See Edits]
yo so i am making a character movement system for my fps game input,etc. is working perfectly only problem is it keeps flinging my character on collision/impact with another object and i cant have tht in a fps heres the code-
local movement = {
Forward = function(plr)
print(plr.Character:GetAttribute("Mobility"))
local hrp = plr.Character.HumanoidRootPart
local bv = Instance.new("BodyVelocity")
bv.Parent = hrp
bv.MaxForce = Vector3.new(math.huge,0,math.huge)
bv.Velocity = hrp.CFrame.LookVector *50
bv.P = (100/plr.Character:GetAttribute("Mobility"))
deb:AddItem(bv,0.5)
end,
Backward = function(plr)
print(plr.Character:GetAttribute("Mobility"))
local hrp = plr.Character.HumanoidRootPart
local bv = Instance.new("BodyVelocity")
bv.Parent = hrp
bv.MaxForce = Vector3.new(math.huge,0,math.huge)
bv.Velocity = hrp.CFrame.LookVector *-50
bv.P = (100/plr.Character:GetAttribute("Mobility"))
deb:AddItem(bv,0.5)
end,
Left = function(plr)
print(plr.Character:GetAttribute("Mobility"))
local hrp = plr.Character.HumanoidRootPart
local bv = Instance.new("BodyVelocity")
bv.Parent = hrp
bv.MaxForce = Vector3.new(math.huge,0,math.huge)
bv.Velocity = hrp.CFrame.RightVector *-50
bv.P = (100/plr.Character:GetAttribute("Mobility"))
deb:AddItem(bv,0.5)
end,
Right = function(plr)
print(plr.Character:GetAttribute("Mobility"))
local hrp = plr.Character.HumanoidRootPart
local bv = Instance.new("BodyVelocity")
bv.Parent = hrp
bv.MaxForce = Vector3.new(math.huge,0,math.huge)
bv.Velocity = hrp.CFrame.RightVector *50
bv.P = (100/plr.Character:GetAttribute("Mobility"))
deb:AddItem(bv,0.5)
end,
Upward = function(plr)
print(plr.Character:GetAttribute("Mobility"))
local hrp = plr.Character.HumanoidRootPart
local bv = Instance.new("BodyVelocity")
bv.Parent = hrp
bv.MaxForce = Vector3.new(0,math.huge,0)
bv.Velocity = hrp.CFrame.UpVector *50
bv.P = (plr.Character:GetAttribute("Mobility"))
deb:AddItem(bv,0.5)
end,
}
how do i stop the flinging??
edit: feel free to suggest advanced methods for this
edit:
so for this how do i get the floor ik tht the humanoid has a property for floormaterial but how do i get the floor object