As the title explains, I’m having trouble making my part move forward. I’ve tried tweens, bodyvelocity, lookvector, but since I’ve never tried much of this stuff, I couldn’t get anything to work. I have the part rotating, too, so I don’t know if that is interfering.
local w1 = game.ReplicatedStorage.Breathings:WaitForChild("w1"):Clone()
w1.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,4,0)
w1.Parent = workspace
local info11 = TweenInfo.new(2,Enum.EasingStyle.Linear)
local goal11 = {}
goal11.Position = w1.CFrame * CFrame.new(0,0,-75)
goal11.Transparency = 1
local tween11 = tweenservice:Create(w1,info11,goal11):Play()
game.Debris:AddItem(w1,1)
spawn(function()
repeat
wait()
w1.CFrame = w1.CFrame * CFrame.fromEulerAnglesXYZ(-0.2,0,0)
until
false
end)
Sometimes, the part goes forward, not in accordance to the player, but actually to a dummy. Other times, like this, the part simply spins on the spot, and doesn’t move at all. Any ideas on what is happening, and how to fix it?
local player = game.Players.LocalPlayer
local character = player.Character
local HRP = character.HumanoidRootPart
local distance = 20
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear)
local tween = TweenService:Create(HRP, tweenInfo, { CFrame = HRP.CFrame * CFrame.new(0, 0, -distance) })
tween:Play()
This will move the character straight forward. You have to mulitple CFrames by CFrame values or else it won’t work. Another thing, negative on the z axis is forward.