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

Is there an error with the variable?

local pl = script.Parent.Parent.TextBox.Text




local topkek = script.Parent.Text


script.Parent.MouseButton1Down:connect(function()
	game:GetService('TeleportService'):Teleport(471383497, game.Players.pl)
end)


I'm not sure as to why an error is occuring.

*13:01:22.378 - pl is not a valid member of Players 13:01:22.379 - Stack Begin 13:01:22.380 - Script 'Players.derfvb123.PlayerGui.ScreenGui.lel.LocalScript', Line 10 13:01:22.381 - Stack End *

2 answers

✓ Accepted answer

The problem is that you are trying to find a member of players called pl. You need to find the player whose name is equal to the value of pl, using the index operator:

local pl = script.Parent.Parent.TextBox.Text




local topkek = script.Parent.Text


script.Parent.MouseButton1Down:connect(function()
    game:GetService('TeleportService'):Teleport(471383497, game.Players[pl])
end)



The issue is, that error comes up when you try and call a variable in a direct manner. You need to find the object with the value equal to "pl".

Refer to this ROBLOX Wiki Article to help you out; Click Me!

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