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

Getting Error "is not a valid member of Players"?

Player = script.Parent.Parent.Parent.Parent.Main.Selecteduser.User.Text
EconomyAgree = script.Parent.Parent.Parent.Parent.EconomyAgree
	
script.Parent.MouseButton1Click:Connect(function()
	game.Players[Player].PlayerGui.ManualCheckInConfirm.Economy:TweenPosition(UDim2.new(.33,0,.714,0))
	EconomyAgree:TweenPosition(UDim2.new(.042,0,.652,0))
	EconomyAgree.Visible = false
end)

I have a script but it says that the line "game.Players[Player]" is not a valid member of Players but Player has a name in it.

1 comment

0

Is this a local script or a regular script?

2 answers

With the game.Players[Player] Line I think you'd want to use a Tostring of the player using the text so while inside a FindFirstChild. So the script will be searching the Players Section to find the player and you are converting the tostring to text.

Player = script.Parent.Parent.Parent.Parent.Main.Selecteduser.User.Text
EconomyAgree = script.Parent.Parent.Parent.Parent.EconomyAgree

script.Parent.MouseButton1Click:Connect(function()
    game.Players:FindFirstChild(tostring(Player)).PlayerGui.ManualCheckInConfirm.Economy:TweenPosition(UDim2.new(.33,0,.714,0))
    EconomyAgree:TweenPosition(UDim2.new(.042,0,.652,0))
    EconomyAgree.Visible = false
end)

Hope this helps. I haven't tested it for myself but if it does, accept this answer please.

1 comment

0

I get this error now! " - Players.DennisSense.PlayerGui.ScreenGui.EconomyAgree.Submit.TextButton.Script:11: attempt to index a nil value"

Player = script.Parent.Parent.Parent.Parent.Main.Selecteduser.User
EconomyAgree = script.Parent.Parent.Parent.Parent.EconomyAgree
 
script.Parent.MouseButton1Click:Connect(function()
    game.Players[Player.Text].PlayerGui.ManualCheckInConfirm.Economy:TweenPosition(UDim2.new(.33,0,.714,0))
    EconomyAgree:TweenPosition(UDim2.new(.042,0,.652,0))
    EconomyAgree.Visible = false
end)

This worked, make sure you put it in a Local Script!

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