What do you want to achieve? Keep it simple and clear! I want to make a textbutton to change a value of “IntValue” . the value comes from the textbox when I trigger the textbutton it will change the value of the intvalue t o the textbox value then the the surfacegui textlabel will change into the value of the int value.
What is the issue? Include screenshots / videos if possible! The issue is I can’t find anything helpful to my proble,
What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yes, but nothing is helpful. I’m just a beginner.
I tried to make a script but it doesnt work.
I tried using remote events from client to server since i want to change the value from server
No it’s not. int means integer, so it can only store numbers without a fractional part. Use a StringValue. If it is completely made out of numbers then it’s OK, but you’ll need to use tonumber.
local flightnumvalue = script.Parent.Parent.states.flightnum
local statesfolder = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui').states
local texts = script.Parent.TextBox
for i,v in pairs(statesfolder:GetDescendants()) do
print(v.Name)
if v:IsA("TextLabel") then
script.Parent.TextButton.MouseButton1Click:Connect(function()
script.Parent.RemoteEvent:FireServer(v)
end)
end
end
Server:
local texts = script.Parent.TextBox
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr, v)
local texts = plr.PlayerGui.a.TextBox
local flightnumvalue = plr.PlayerGui.states.flightnum
flightnumvalue.Value = texts.Text
wait(1)
v.Text = tostring(flightnumvalue.Value)
end)
But you are modifying the players GUI, plr.PlayerGui. You aren’t modifying all players’ GUIs. You should add another RemoteEvent for that, and use FireAllClients.
The issue is, you’re trying to detect a player’s GUI from the server. These sorts of things don’t change on the server side, only the client. Consider instead getting the value of the box on the client side, then passing that value through the RemoteEvent for the server to use.