Basicly im trying to make a move like tsb where we run but I have a problem where the part always tilts a little which make the character go in the floor (slightly).
This is how its supposed to look like:
how it looks like when the velocity is enabled:
We can see that the legs are in the floor.
Here’s the script (its a local one) and its not the full code, i just put the collision and velocity thing.
local Part = Instance.new("Part")
Part.CanCollide = false
Part.Size = Vector3.new(4,3,6)
Part.Parent = workspace.Fx
Part.CanQuery = false
Part.Transparency = .5
Part.Color = Color3.fromRGB(105, 153, 255)
Part.Massless =true
Part.Position = char.PrimaryPart.Position -- Vector3.new(0,2,0)
Part.Orientation = Vector3.new(0,char.PrimaryPart.Orientation.Y,0)
local Collision = Instance.new("Part")
Collision.Shape = "Ball"
Collision.Size = Vector3.new(2,2,2)
Collision.Parent = char
Collision.Name = "Collision"
Collision.CanQuery = false
Collision.Transparency = .5
Collision.Color = Color3.fromRGB(0, 0, 0)
Collision.Massless =true
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://79340075631032"
Track = plr.Character.Humanoid.Animator:LoadAnimation(Animation)
Track:Play(nil,nil,1.75)
Weld(Part, char.PrimaryPart)
Weld(Collision, char.PrimaryPart)
local attachment = Instance.new("Attachment")
attachment.Name = "DashAttachment0"
attachment.Parent = Part
local linearVelocity = Instance.new("LinearVelocity")
linearVelocity.Attachment0 = attachment
linearVelocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
linearVelocity.RelativeTo = Enum.ActuatorRelativeTo.World
linearVelocity.Enabled = false
linearVelocity.Parent = attachment
local att1Right = game.ReplicatedStorage.TrailEffect.Attachment1:Clone()
local att2Right = game.ReplicatedStorage.TrailEffect.Attachment2:Clone()
att1Right.Parent = Part
att2Right.Parent = Part
att1Right.Trail.Attachment0 = att1Right
att1Right.Trail.Attachment1 = att2Right
task.wait(3)
local params = RaycastParams.new()
params.FilterDescendantsInstances = {workspace.Baseplate, workspace.Fx, workspace.Characters}
params.FilterType = Enum.RaycastFilterType.Exclude
local X = Instance.new("NumberValue")
X.Value = 240
local Y = 0
local Tween = ts:Create(X,TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.In,0,true),{Value = 250})
Tween:Play()
linearVelocity.Enabled = true
Loop = rs.RenderStepped:Connect(function()
hum:SetStateEnabled(Enum.HumanoidStateType.Freefall, true)
local ray = workspace:Raycast(Part.Position,Vector3.new(0,-5,0),params)
if ray then
linearVelocity.Enabled = true
linearVelocity.VectorVelocity = Part.CFrame.LookVector * X.Value - Vector3.new(0,20,0)
linearVelocity.MaxForce = 35000
else
linearVelocity.Enabled = false
end
end)
Tween.Completed:Connect(function()
task.wait(20)
Collision:Destroy()
Track:Stop()
Part:Destroy()
Loop:Disconnect()
att2Right:Destroy()
att1Right:Destroy()
linearVelocity:Destroy()
end)
I think it has something to do with the orientation of the velocity part but I cant do anything since there’s a weld which makes it slightly orientated towards the floor. What i mean:
Orientation needed: (0,something,0)
Orientation obtained: (.011,something,0)
Please help me if you can.