This seems like a basic question to me. I've tried multiple this.
I've tried,
local tool = script.Parent local plr = game.Players.LocalPlayer local char = plr.Character or plr.CharacterAdded:wait() local Torso = char:WaitForChild("Torso") local mouse = plr:GetMouse() tool.Equipped:connect(function() tool.Activated:connect(function() Torso.CFrame = (Torso.CFrame*CFrame.new(Torso.CFrame.lookVector*20)) end) end)
I've also tried,
local tool = script.Parent local plr = game.Players.LocalPlayer local char = plr.Character or plr.CharacterAdded:wait() local Torso = char:WaitForChild("Torso") tool.Equipped:connect(function() tool.Activated:connect(function() Torso.CFrame = Torso.CFrame:toWorldSpace(CFrame.new(Torso.CFrame.lookVector)) end) end)
:toWorldSpace()
and this had almost the same result as the other attempt.There were no errors. The only problem is the way it moves the player. Sometimes the player can get moved backwards and other times the player moves sideways. It only seems to work if the player is facing a single direction.
Any help would be awesome.
Thank you.
To move a CFrame 20 studs forwards, you need to use a Z of -20. Very odd.
Torso.CFrame = Torso.CFrame * CFrame.new(0,0,-20)
Make sure they don't get stuck in a wall ^^