shiloSZN
(Jordan Stroud)
December 28, 2023, 11:48pm
#1
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.
However, it’s not responding
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!
ItsEGT
(EGT)
December 28, 2023, 11:50pm
#2
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)
shiloSZN
(Jordan Stroud)
December 28, 2023, 11:54pm
#4
Thank you both for the reply, however, it’s still not changing the value.
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)
shiloSZN
(Jordan Stroud)
December 29, 2023, 12:21am
#6
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.
system
(system)
Closed
January 12, 2024, 12:21am
#7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.