Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is the script not working?

Players = game:GetService("Players")

function onPlayerAdded(player)
	while wait(.1) do
		local RPart = Instance.new("Part")
		local RPosition = player.Head.Position
		RPart.Position = RPosition
		RPart.BrickColor = BrickColor.new("Green")
		repeat until 1 == 2
	end
end

game.Players.PlayerAdded:connect(onPlayerAdded)

for _,player in pairs(Players:GetPlayers()) do
	onPlayerAdded(player)
end

It said: "13:06:50.064 - Head is not a valid member of Player".

1 answer

Line 6: local RPosition = player.Head.Position

It's not player.Head because you're getting the player and not the Character. Head is inside the Character Model.

So change it to: player.Character.Head

This discussion is preserved as it was. New answers, comments, and votes are closed.