Need help with wave code

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
  1. If statements are not loops, use a while loop to change the wave number incrementally
  2. 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
  3. 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
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

thank u i will try this one, appreciate it man!

hello i tried this but everytime i die, the wave starts all over again how do i fix this?

Where are you putting this script? In starterplayerscripts?