if script.Parent.Text == "5" then
game.ReplicatedStorage.NextLevelEvent:FireServer()
print("server fired")
end
COMMUNITY QUESTION
Why is this if statement with the text lable not firing the server?
2 answers
Try this
local debounce = false
while wait() do
if deboune == false then
debounce = true
if script.Parent.Text == "5" then
game.ReplicatedStorage.NextLevelEvent:FireServer()
print("server fired")
wait(3) -- The amount of time until it fires again
debounce = false
end
end
end
1 comment
0
That would error, you are firing it too many times
I'm sure this should work, what it does is whenever the text is changed, it will check if the text is "5" and if it's 5 then it will fire the event.
script.Parent:GetPropertyChangedSignal("Text"):Connect(function() -- when text is changed
if script.Parent.Text == "5" then
game.ReplicatedStorage.NextLevelEvent:FireServer()
print("server fired")
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Is this a local script?
yes its a local script.
is it not printing?