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

How to I get input text from a text box?

I'm making an admin panel where you can give or take away points from a player by putting their username and the amount in a text box and then it takes those inputs to set player value, but it's not taking the text. Here's the script:

script.Parent.MouseButton1Click:Connect(function()
	local player = script.Parent.Parent.To.Text
	local amount = script.Parent.Parent.Amount.Text
	game.Players[player].rep.Value = amount
end)

that's just one of them but the rest don't work either and I'm pretty sure if I can get this one fixed I can fix them all. The text values just come back as nothing, and I proved this by putting print(player, amount) and it just came up as nothing and it gives the error " is not a valid member of Players". how do i fix this?

2 comments

0

This wouldn't work regardless due to FE.

0

You have to use this on the client because the text wont apply on the server. Use a localscript with this code, but then fire a remote event with the arguments to the server to cause the point loss

1 answer

✓ Accepted answer

You will have to use remote events for this as textbox text is client only. Local script:

game.ReplicatedStorage.RemoteEvent:FireServer(script.Parent.Parent.TextBox.Text)

script:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr, text) --Text will be the textbox's text.

Hope this helped!!

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