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

Why is the script not working?

Asked by 9 years ago
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

Log in to vote
0
Answered by
xPolarium 1388 Moderation Voter
9 years ago

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

Ad

Answer this question