Hi
Basically i have a skateboard/part with wheels that moves forwards at medium high speeds.
When i try to position the player TO that part(Via alignPosition constraint) however, it goes completely crazy (at high speeds, and a bit of tiny shaking at low speeds).
BUT
When i don’t position the player, and just make my camera follow the skateboard without any player positioning invloved, it acts normal, even at high speeds. I mean i still flies into the sky when theres a ramp for example, and sort of does some spinning in the air, but that is to be expected, since im using a constant vectorForce for movement, however when i try to align the player to the skateboard (especially in air) it starts to spin uncontrollably
This is my code for aligning the player, it specifically disables any mass or collisions!
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local skateboard = workspace.SkaterboardTemplate
for i,v in ipairs(skateboard:GetChildren()) do
if v:IsA("BasePart") then
v:SetNetworkOwner(plr)
end
end
local humanoid = char:WaitForChild("Humanoid")
local hrp = char:WaitForChild("HumanoidRootPart")
local att = Instance.new("Attachment", hrp)
att.CFrame *= CFrame.new(0,-2.7,0)
local alignPlayerPosition = Instance.new("AlignPosition", hrp)
alignPlayerPosition.MaxForce = math.huge
alignPlayerPosition.Attachment0 = att
alignPlayerPosition.Responsiveness = 200
alignPlayerPosition.Attachment1 = skateboard.Main.Attachment
local alignPlayerRotation = Instance.new("AlignOrientation", hrp)
alignPlayerRotation.MaxTorque = math.huge
alignPlayerRotation.Attachment0 = att
alignPlayerRotation.Responsiveness = 200
alignPlayerRotation.Attachment1 = skateboard.Main.Attachment
humanoid.PlatformStand = true
for _,v in ipairs(char:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
v.Massless = true
v.CanCollide = false
v.CollisionGroup = "Board"
end
end
end)
end)
Any help is welcomed and appreciated!
EDIT:
I do have a version of the code that uses directly M6ds to attach the player, which is also glitchy(and ofc when i remove the weld between the player and the skateboard, it starts acting completley normal.)
The only thing im looking for is for it to just feel like theres no player involved at all(while there still being one).
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local skateboard = workspace.SkaterboardTemplate
for i,v in ipairs(skateboard:GetChildren()) do
if v:IsA("BasePart") then
v:SetNetworkOwner(plr)
end
end
local humanoid = char:WaitForChild("Humanoid")
local hrp = char:WaitForChild("HumanoidRootPart")
local weld = Instance.new("Motor6D", skateboard.Main)
weld.Part0 = skateboard.Main
weld.Part1 = hrp
weld.C0 = CFrame.new(0,2.7,0)
humanoid.PlatformStand = true
for _,v in ipairs(char:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
v.Massless = true
v.CanCollide = false
v.CollisionGroup = "Board"
end
end
end)
end)