#The script in a GUI won't work when I enter something in a textbox
34 messages · Page 1 of 1 (latest)
local textBox = script.Parent
-- Function to check the text value
local function checkTextValue()
local textValue = textBox.Text
local numberValue = tonumber(textValue)
-- Check if the text is a number
if numberValue then
-- Check if the number is between 1 and 99
if numberValue >= 1 and numberValue <= 99 then
print("The number is valid: " .. numberValue)
else
print("Invalid number. Number must be between 1 and 99.")
end
else
print("The text is not a number.")
end
end
-- Connect the function to the TextBox's Changed event
textBox:GetPropertyChangedSignal("Text"):Connect(checkTextValue)
pls format code bef sending
do you know whats wrong?
local textBox = script.Parent
-- Function to check the text value
local function checkTextValue()
local textValue = textBox.Text
local numberValue = tonumber(textValue)
-- Check if the text is a number
if numberValue then
-- Check if the number is between 1 and 99
if numberValue >= 1 and numberValue <= 99 then
print("The number is valid: " .. numberValue)
else
print("Invalid number. Number must be between 1 and 99.")
end
else
print("The text is not a number.")
end
end
-- Connect the function to the TextBox's Changed event
textBox:GetPropertyChangedSignal("Text"):Connect(checkTextValue)
no
oh
** You are now Level 1! **
it prints nothing
or should i execute it in a local script?
yes
ty it prints
help me too
Ok
** You are now Level 2! **
but i want it to delete a part in the explorer
but a local script will make it only be deleted for me
create a server script then
that deletes the part
do i add a serverscript in the startergui or serverscriptservice?
serverscriptservice
do i use fire remote event?
sure
to communicate from client -> server or vice versa
ok ty
** You are now Level 2! **