Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Only Get the horizontal plane of lookVector?

Asked by 7 years ago

I'm making a script where when you double tap the "w" key, you get propelled at the direction your camera is facing. I only want it to propel you in a horizontal direction, (x and z) and not a vertical direction (y). (All the code is in a LocalScript inside of StarterCharacter Scripts) Here is my Code so far:

01--Getting the Camera
02    game.Players.PlayerAdded:connect(function(player)
03        script.LocalScript:clone().Parent = player.CharacterAdded:wait()
04    end)   
05 
06 
07--Local Variables  
08local cam = workspace.CurrentCamera
09local player = game.Players.LocalPlayer
10local Char = player.Character
11local Humanoid = Char:WaitForChild("Humanoid")
12local Mouse = player:GetMouse()
13local lastTapTime = 0
14local clicked = false
15local Trail = game.ServerStorage.Trail:Clone()
View all 60 lines...

I'd also like to point out that this script doesnt work when I publish the game, and play it from the site. Any solutions are greatly appreciated!!

0
v3*Vector3.new(1,0,1) would flatten it to horizontal. cabbler 1942 — 7y
0
So I would put that after cam.CFrame.LookVector? Sorry for late responce McQuakyDuck 8 — 7y
0
Wait i got it, thanks so much! McQuakyDuck 8 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

You don't!

Ad

Answer this question