Change TextBox Value for indivisual players

So I am trying to script out something where the player inputs in a number into a textbox, a specific event would happen. And another after 2 seconds.

The problem is after typing in, the value stays at the default value ,1.

I am using a server script

My current script is

game.Players.PlayerAdded:Connect(function(player)
    local BoxValue = game.StarterGui.ScreenGui.Frame.TextBox.Text
    while true do
        print("Box Value is"..BoxValue.."")
        --Other Code that involves Box Value
        wait(2)
    end
end)

So how do I change the text value for individual players?

It’s hard to understand what you mean by the default value. What exactly are you trying to do. Is it a value in a textlabel, or something else?

So the text box text is 1. I set it to 1. Players are to change the text to another number to experience a different event. So the text value in the text box

You cannot change anything (to an extent) for individual players with a server script as server scripts cannot access player GUIs. Try exploring the world of local scripts instead.

So for my local scripts. Where should I insert it under? Do I put it in Player Scripts? Do I change the starter gui to player gui?

I suggest putting it under The UI in StarterGui so it’s easier to reference.

Local scripts behave differently than server scripts. They can only do this ‘locally’ or only to the user. Try to read up a few posts about it or watch a few YouTube videos explaining it, I find it best to learn scripting through videos.

2 Likes