TextBox not responding

Hey Developers. Happy holidays!

First off, I need help with a scoreboard panel.

I have a referee panel that makes it that whatever text you put in the text box, it’ll put the number in the ReplicatedStorage value.

image

However, it’s not responding

image

Here is the button script:

script.Parent.MouseButton1Click:connect(function()
	game.Workspace.GameValues.HomeScore.Value = script.Parent.Parent.ScoreBox.Text
end)

It’s a local script inside of the “ChangeScore” button, which seems like it should work…

Please let me know if you know how to fix this!

script.Parent.Parent.ScoreBox.Text

This returns a string. Use tonumber().

1 Like

Since you’re using an integer value, it can only hold numbers. You can fix this by using tonumber() on the textbox input.

game.Workspace.GameValues.HomeScore.Value = tonumber(script.Parent.Parent.ScoreBox.Text)

Thank you both for the reply, however, it’s still not changing the value.

image

Is it because it’s a script, and not a local script?

Probably because its a local script. You can use remote events to transfer the data over from the client to the server, heres an example.

Server:

local remote = path.to.remote.event
remote.OnServerEvent:Connect(function(player,value)
game.Workspace.GameValues.HomeScore.Value = tonumber(value)
end)

Client:

local remote = path.to.remote.event
script.Parent.MouseButton1Click:connect(function()
	remote:FireServer(script.Parent.Parent.ScoreBox.Text)
end)

I was doing research, and I have to transfer the values from Client using the gui’s local script, and Server using a ServerScriptService, this also help boost my research. Thank you everyone.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.