I wrote a line that I thought will locate a player’s head but honestly, it didn’t work, and I know that it won’t because it’s not just right.
So I need to write a ‘local’ line that locates the players/characters head in my game, and I am struggling to write it.
Here’s what I wrote:
Can anyone please rewrite the line for me and help?
Just so you are aware: LocalPlayer will not work in the server script (the regular script you are talking about) because that script is server side, not client.
--server script
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local head = character:WaitForChild("Head")
end)
--local (client) script
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local head = character:WaitForChild("Head")