Hi, I am making a terminal for a war group. But the script won't work? There is a model in Workspace called as Terminal and inside that there is a part called as Beam. Inside the beam there is a script called as RaidScript. And Inside the RaidScript there is a GUI named as CaptureGUI. Now the problem is that the GUI Text won't change and the beam color won't change. Here's the script:

script.CaptureGUI:Clone().Parent = game.StarterGui
timeuntilwin = 1200
totaltime = 1200
h = game.Players.LocalPlayer.PlayerGui.CaptureGUI.Hint
defendteamcolor = "Smoky grey"
raidteamcolor = "Bright red"
status = h.Parent.Status
winscreen = h.Parent.Win
winmsg = h.Parent.WinText

function OnTouched(hit)
	if hit.Parent:findFirstChild("Humanoid") ~= nil then
		if game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == BrickColor.new(raidteamcolor) then
			script.Parent.BrickColor = BrickColor.new(raidteamcolor)
			timeuntilwin = totaltime
			
		end
		if game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == BrickColor.new(defendteamcolor) then
			script.Parent.BrickColor = BrickColor.new(defendteamcolor)
			timeuntilwin = totaltime
		end
	end
end
script.Parent.Touched:connect(OnTouched)

while true do
	wait()
	if script.Parent.BrickColor == BrickColor.new(raidteamcolor) then
		h.Text = "Raiders will win in".." "..timeuntilwin
		if timeuntilwin <= totaltime and timeuntilwin > 0 then
			wait(1)
		timeuntilwin = timeuntilwin - 1 end
		if timeuntilwin == 0 then
			h.Text = " "
			status.Visible = false
			winscreen.Visible = true
			winmsg.Text = "Raiders have won!"
			wait(5)
			winscreen.Visible = false
			status.Visible = true
			h.Text = "Raid has got over."
		else
			if script.Parent.BrickColor == BrickColor.new(raidteamcolor) then
				h.Text = "Defenders will win in".." "..timeuntilwin
				if timeuntilwin <= totaltime and timeuntilwin > 0 then
					wait(1)
				tiemuntilwin = timeuntilwin - 1 end
				if timeuntilwin == 0 then
					h.Text = " "
			status.Visible = false
			winscreen.Visible = true
			winmsg.Text = "Defenders have won!"
			wait(5)
			winscreen.Visible = false
			status.Visible = true
			h.Text = "Raid has got over."
					
				end
			end
		end
	end
end

All the names are correct. Can someone please tell me what mistake I have done? Thank you for helping/reading. :)

3 comments

0

Do you have an error in Developer Console or Output? If so, please post it!

0

Try using locals at the top.

0

@M99a9am3R Output gives no error. @BetterScriptable Did that but did not work.