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

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

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

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!

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