I want to make so when character activates the tool, the character starts flying only in the camera direction for certain amount of time, is there any way to do that?
yeah, just use bodyvelocity and the camera’s look cframe
I think I understand it, thanks I’ll try it.
Okay so I tried to make it, but there’s 3 problems which I don’t know how to fix. First of all, is that I can’t make it so the character cant jump. Second problem is that the HumanoidRootPart is looking in the direction of the camera but the character is not moving in the direction of the camera, the third problem is that the character looking the opposite of the camera direction.
Here is the Server Script:
local Tool = script.Parent
local Player = Tool.Parent.Parent
local Character = Player.Character
local debounce = false
Tool.Name = "Sleigh Ride"
local RealCooldown = 25
local DashTime = 15
local DashSpeed = 50
local Cooldown = RealCooldown
Tool.Activated:Connect(function()
if not debounce then
debounce = true
Tool.Name = "Using"
local CanJump = false
local Dash = Instance.new("BodyVelocity")
Dash.Parent = Character:FindFirstChild("HumanoidRootPart")
Dash.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
Dash.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * DashSpeed
Character:FindFirstChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
Character:FindFirstChild("Humanoid").Sit = true
Character:FindFirstChild("Humanoid").Jumping:Connect(function()
if CanJump == false then
Character:FindFirstChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
Character:FindFirstChild("Humanoid").Sit = true
else
Character:FindFirstChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
Character:FindFirstChild("Humanoid").Sit = false
end
end)
script.LocalScript.Enabled = true
if Character:FindFirstChild("Chest") then
Character:FindFirstChild("Sleigh").Transparency = 0
end
task.wait(DashTime)
Dash:Destroy()
CanJump = true
script.LocalScript.Enabled = false
if Character:FindFirstChild("Chest") then
if Character:FindFirstChild("Sleigh") then
Character:FindFirstChild("Sleigh").Transparency = 1
end
end
repeat task.wait(0.1)
Cooldown -= 0.1
Tool.Name = math.floor(Cooldown*10)/10
until Cooldown <= 0
task.wait(Cooldown)
debounce = false
Tool.Name = "Sleigh Ride"
Cooldown = RealCooldown
end
end)
Here is the Local Script:
local Player = game.Players.LocalPlayer
local Character = Player.Character
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Camera = workspace.CurrentCamera
while task.wait(0.025) do
HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position, Camera.CFrame.Position)
end
Do you know how to solve these problems?
Correct me if im wrong, but are BodyVelocity instances (if not all forms of legacy bodymovers) long since deprecidated and pending complete removal from the engine?
Personally, i reccomend that you handle movement another way. Perhaps alignposition (((iirc they might have a vector3 pos value but i cant remember))). if not then use CFrame movement logic, its the best and future proof option specially if legacy bodymovers are deprecidated.
Happy programming!