• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


01 Dec, 2024

Updated at 12 Dec, 2024

How would I access the direction of which my player's camera is facing?

Hey everyone,

I’m trying to make a script that moves a part in the direction that a player is facing, the issue is, the player’s lookvector never updates, and it always stays the same. I have no idea how to get through this, and I’ve tried a bunch of different things like using the Humanoid part / character part of my player. Any breakthroughs would be much, much appreciated.

local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local camera = workspace.CurrentCamera
local character = localPlayer.Character:WaitForChild("Humanoid")
local lookvector = canera.LookVector
local runtime = game:GetService("RunService")
runtime.Stepped:Connect(function(deltaTime)
	print(lookvector)
end
	
)



local input = game:GetService("UserInputService")
local ebutton = Enum.KeyCode.E

input.InputBegan:Connect(function(input, gameProcessed)
		if input.KeyCode == ebutton then
	local remotedetonator = game.ReplicatedStorage.RemoteEvent
	remotedetonator:FireServer(lookvector)

		end
end)


3 posts - 2 participants

Read full topic