Player Counter Wont refresh

Hey guys, I’m kind of new in the whole scripting thing and i have this watermark on my server so it shows the players online however it doesn’t refresh unless i manually do it through F8 > restart watermark, i think i forgot to add something in the code but im not sure what i forgot, ill leave the code bellow and if you see something i forgot it would be grately appreciated :slight_smile:

-- CONFIG --

-- The watermark text --
servername = "~w~[~s~Jucatori Online ".. GetNumberOfPlayers() .."~w~/~s~32~w~]" 

-- The x and y offset (starting at the top left corner) --
-- Default: 0.005, 0.005
offset = {x = 0.455, y = 0.025}

-- Text RGB Color --
-- Default: 64, 64, 64 (gray)
rgb = {r = 64, g = 64, b = 64}

-- Text transparency --
-- Default: 255
alpha = 255

-- Text scale
-- Default: 0.4
-- NOTE: Number needs to be a float (so instead of 1 do 1.0)
scale = 0.4

-- Text Font --
-- 0 - 5 possible
-- Default: 1
font = 4

-- Rainbow Text --
-- false: Turn off
-- true: Activate rainbow text (overrides color)
bringontherainbows = true

-- CODE --
Citizen.CreateThread(function()
	while true do
		Wait(1)

		if bringontherainbows then
			rgb = RGBRainbow(1)
		end
		SetTextColour(rgb.r, rgb.g, rgb.b, alpha)

		SetTextFont(font)
		SetTextScale(scale, scale)
		SetTextWrap(0.0, 1.0)
		SetTextCentre(false)
		SetTextDropshadow(2, 2, 0, 0, 0)
		SetTextEdge(1, 0, 0, 0, 205)
		SetTextEntry("STRING")
		AddTextComponentString(servername)
		DrawText(offset.x, offset.y)

	end
end)

-- By ash
function RGBRainbow(frequency)
    local result = {}
    local curtime = GetGameTimer() / 1000

    result.r = math.floor(math.sin(curtime * frequency + 0) * 127 + 128)
    result.g = math.floor(math.sin(curtime * frequency + 2) * 127 + 128)
    result.b = math.floor(math.sin(curtime * frequency + 4) * 127 + 128)

    return result
end

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.