I made a script that when the player spawns, a brick spawns, and is welded to the players head. When I run the script below, the output says that player.Head does not exist.
local remoteEvent = game.ReplicatedStorage.remoteEvent remoteEvent.OnServerEvent:Connect(function(player) local head = player.Head local humanoid = player.Character.Humanoid local part = Instance.new("Part") part.Name = part part.Anchored = true part.Parent = workspace local weld = Instance.new("Weld") weld.Parent = game.Workspace.part weld.Part0 = head weld.Part1 = part
Can someone please tell me what's wrong? I can't seem to find out because when I run the game and look at my player in Workspace, one of the children is the Head. Also pointing out any other things I did wrong would be very well appreciated.
The player doesn't hold "Head". The character does so:
local remoteEvent = game.ReplicatedStorage.remoteEvent remoteEvent.OnServerEvent:Connect(function(player) local head = player.Character.Head local humanoid = player.Character.Humanoid local part = Instance.new("Part") part.Name = part part.Anchored = true part.Parent = workspace local weld = Instance.new("Weld") weld.Parent = game.Workspace.part weld.Part0 = head weld.Part1 = part