Hello! I was trying to create a system: if you click a button, it prints the text inside the textbox, but the error is that the output print the text at the start, not the new text wrote.
I tried with bindable events, nothing happened.
What do you guys suggest to do?
When I just click run instead of play it prints, else it prints the old text.
Assign the value from BindableEvent to a number value
script.Parent.Information.Event:Connect(function(value)
if tostring(value) then
print("String, not a number")
elseif tonumber(value) then
script.Parent.Points.Value = value
end
end)
This is the original script before ask help:
Parent of the textbox:
script.Parent.FocusLost:Connect(function()
local text = script.Parent.Text
script.Parent.Parent.Information:Fire(script.Parent.Text)
end)
Change value:
script.Parent.Information.Event:Connect(function(value)
if tostring(value) then
print(":: Board Points :: Value is a string, not a number")
elseif tonumber(value) then
script.Parent.Points.Value = value
end
end)
Script that send an event that fire points.
local value = script.Parent.Parent.Points.Value
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Country.Value == "" then
print(":: No button specified::")
else
print(value)
script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.API:Fire("Award", value)
end
end)
Yeah, it kind of works, except you have to click off the textbox in order for it to actually execute the code. Still, pretty cool how you managed to type all that.
Are they all server scripts? I cant tell from the imaging. You need local scripts for UI. You’ll want to use RemoteEvents to communicate from a local to a server script in ServerScriptService. Don’t entirely know what you are tryna do