Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My terminal script is broken Why?

Alright, I am trying to make a good terminal script for my groups base but, It isn't working...

local wintime = 1200
local totaltime = 1200
local timegodown = 1 -- how many seconds of time go down for the term
local h = Instance.new("Hint")
script.Parent.Touched:connect(function(hit)
	if hit.Parent:findFirstChild("Humanoid") ~= nil then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player then
			if player.TeamColor == BrickColor.new("Really black") then
				script.Parent.BrickColor = BrickColor.new("Really black")
				h.Parent = game.Workspace
				h.Text = "The Necromongers Own the Term!"
				wait(3)
				h:Remove()
			end
			while wait() do
				if script.Parent.BrickColor == BrickColor.new("Really black") then
					h.Parent = game.Workspace
					while wait() do
						
						h.Text = "The Necromongers have"..wintime-timegodown.." seconds left before Winning!" -- Only goes down 1 seconds and stays at 1199
					end
					
				end
			end
		end
	end
end)

2 answers

✓ Accepted answer

It's because you're telling it to print the same value each time.

wintime = 1200 timegodown = 1

wintime-timegodown = 1199

It's going to output this every time because that's what it equals.

You need to do something like this:

while wait() do
h.Text = "The Necromongers have " .. wintime .. " seconds left before Winning!"
wintime = wintime-timegodown -- This assigns a new value to wintime each time thus dropping it by 1 each time giving you the result I believe you're looking for. 
end

Hope this helped!

2 comments

0

It works! Thanks!!

0

Np. I've ran into this problem myself a few times.

You need to add somewhere in your script:

timegodown = timegodown - 1

This discussion is preserved as it was. New answers, comments, and votes are closed.