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

Workspace.piece.Script:6: attempt to call field 'PlayerAdded' (a userdata value). Help?

Asked by 8 years ago

So, I get this error when trying to run this script. 19:48:02.093 - Workspace.piece.Script:6: attempt to call field 'PlayerAdded' (a userdata value)

base = script.Parent.base
spine = script.Parent.spine
head = script.Parent.head
gui = script.ScreenGui

game.Players.PlayerAdded(function(player)
    script.ScreenGui:Clone().parent = player.PlayerGui
end)

1 answer

Log in to vote
1
Answered by 8 years ago

You didn't connect this to the function using connect.

You have to use :connect() to connect events to functions, like so,

base = script.Parent.base
spine = script.Parent.spine
head = script.Parent.head
gui = script.ScreenGui

game.Players.PlayerAdded:connect(function(player)--added connect
    script.ScreenGui:Clone().parent = player.PlayerGui
end)

And That's All!

Good Luck!

Ad

Answer this question