TixyPix
(OnlyAL)
March 14, 2022, 11:09pm
#1
Hello i am new to scripting, i am making a text gui that changes number of wave, it is a loop and the wave can reach whenever it wants to but I tried this code but it is not working, could anyone help?
local wave =
script.Parent.Text = 'Wave: '..wave
if wait(10) then
wave += 1
end
1 Like
TenBlocke
(Decablocks)
March 14, 2022, 11:25pm
#2
If statements are not loops, use a while loop to change the wave number incrementally
The script.Parent.Text = 'Wave: '…wave line should be inside the while loop i said so that it will update everytime the wave value is updated
you have to initialize wave as a number in the first place, so try to make it 0
If we apply these three your script should look something like this
local wave = 0
while true do
wave += 1
script.Parent.Text = 'Wave: '..wave
task.wait(10)
end
3 Likes
faZepitaa
(SwayCentral)
March 14, 2022, 11:32pm
#3
local wavevariable = Instance.new("IntValue", script.Parent)
local TimeUntilNextWave = 10
local wave = "Wave: ".. wavevariable.Value
while true do
wavevariable.Value += 1
wave = "Wave: ".. wavevariable.Value
script.Parent.Text = wave
print("Wave Changed")
task.wait(TimeUntilNextWave)
end
2 Likes
TixyPix
(OnlyAL)
March 15, 2022, 12:08am
#4
thank u i will try this one, appreciate it man!
TixyPix
(OnlyAL)
March 15, 2022, 12:34am
#5
hello i tried this but everytime i die, the wave starts all over again how do i fix this?
TenBlocke
(Decablocks)
March 15, 2022, 12:52am
#6
Where are you putting this script? In starterplayerscripts?