It is a script inside a TextButton.
My problem is that, when I actually click the button, I get no error messages. However, no brickcolors change, no smoke activates, et cetera. Nothing happens.
Also, assume that "player" is the correct path to the player who enables the script.
local button = script.Parent local player = button.Parent.Parent.Parent.Parent ownervalue = player.PlayerGui.TermTimer.TOwner.Text timevalue = player.PlayerGui.TermTimer.Time.Text CapTime = game.Workspace.ICFTerminal.TermCapSystem.CapTime.Value a = game.Workspace.ICFTerminal.TermCapSystem.Activator hah = game.Workspace.ICFTerminal.TermCapSystem.Hah t1 = game.Workspace.ICFTerminal.TermCapSystem.TeamPart1 t2 = game.Workspace.ICFTerminal.TermCapSystem.TeamPart2 am = game.Workspace.ICFTerminal.TermCapSystem.Activator.Mesh sm1 = game.Workspace.ICFTerminal.SmokeParts.smoke1.Smoke sm2 = game.Workspace.ICFTerminal.SmokeParts.smoke2.Smoke sm3 = game.Workspace.ICFTerminal.SmokeParts.smoke3.Smoke sm4 = game.Workspace.ICFTerminal.SmokeParts.smoke4.Smoke function OnClicked() if player.TeamColor == ("Bright red") then m = Instance.new("Message") m.Text = "The Terminal is being captured by the Raiders!" wait(5) m:Destroy() --First Step: Changing Colors-- a.BrickColor = player.TeamColor hah.BrickColor = player.TeamColor t1.BrickColor = player.TeamColor t2.BrickColor = player.TeamColor wait(.1) --Next Step: Activating Smoke-- sm1.Enabled = true sm2.Enabled = true sm3.Enabled = true sm4.Enabled = true --Step Three: Enabling Timer-- CapTime = 0 ownervalue = "Raiders" while true do timevalue = CapTime.Value + 1 wait(1) end end end script.Parent.MouseButton1Down:connect(function() end)
It's hard to read your code if it isn't tabbed optimally.
local button = script.Parent local player = button.Parent.Parent.Parent.Parent ownervalue = player.PlayerGui.TermTimer.TOwner.Text timevalue = player.PlayerGui.TermTimer.Time.Text CapTime = game.Workspace.ICFTerminal.TermCapSystem.CapTime -- A variable shouldn't be referred to a property, unless if you want to access its value! a = game.Workspace.ICFTerminal.TermCapSystem.Activator hah = game.Workspace.ICFTerminal.TermCapSystem.Hah t1 = game.Workspace.ICFTerminal.TermCapSystem.TeamPart1 t2 = game.Workspace.ICFTerminal.TermCapSystem.TeamPart2 am = game.Workspace.ICFTerminal.TermCapSystem.Activator.Mesh sm1 = game.Workspace.ICFTerminal.SmokeParts.smoke1.Smoke sm2 = game.Workspace.ICFTerminal.SmokeParts.smoke2.Smoke sm3 = game.Workspace.ICFTerminal.SmokeParts.smoke3.Smoke sm4 = game.Workspace.ICFTerminal.SmokeParts.smoke4.Smoke function OnClicked() if player.TeamColor == ("Bright red") then m = Instance.new("Message", workspace) -- Parent the Message! m.Text = "The Terminal is being captured by the Raiders!" wait(5) m:Destroy() --First Step: Changing Colors-- a.BrickColor = player.TeamColor hah.BrickColor = player.TeamColor t1.BrickColor = player.TeamColor t2.BrickColor = player.TeamColor wait(.1) --Next Step: Activating Smoke-- sm1.Enabled = true sm2.Enabled = true sm3.Enabled = true sm4.Enabled = true --Step Three: Enabling Timer-- CapTime.Value = 0 ownervalue = "Raiders" while true do timevalue = CapTime.Value + 1 wait(1) end end end button.MouseButton1Down:connect(onClicked) -- You already referred "script.Parent" to a variable named as "button". Use that instead of the former, to increase efficiency. -- This is the only error I see. This is called a logical error, where no error messages return, but the script is doing what you don't expect it to do.
The ":connect()" method accepts a function as its argument.
It is more ideal to use a LocalScript when accessing the PlayerGui. Also, you needed to call the OnClicked function so I have done so for you. I have also make the script a bit more efficient by accessing the player through game.Players.LocalPlayer
. If the script has issues or you have more questions, please let me know.
local button = script.Parent local player = game.Players.LocalPlayer ownervalue = player.PlayerGui.TermTimer.TOwner.Text timevalue = player.PlayerGui.TermTimer.Time.Text terminal = game.workspace.ICFTerminal CapTime = terminal.TermCapSystem.CapTime a = terminal.TermCapSystem.Activator hah = terminal.TermCapSystem.Hah t1 = terminal.TermCapSystem.TeamPart1 t2 = terminal.TermCapSystem.TeamPart2 am = terminal.TermCapSystem.Activator.Mesh sm1 = terminal.SmokeParts.smoke1.Smoke sm2 = terminal.SmokeParts.smoke2.Smoke sm3 = terminal.SmokeParts.smoke3.Smoke sm4 = terminal.SmokeParts.smoke4.Smoke button.MouseButton1Down:connect(function() if player.TeamColor == ("Bright red") then m = Instance.new("Message") m.Text = "The Terminal is being captured by the Raiders!" wait(5) m:Destroy() --First Step: Changing Colors-- a.BrickColor = player.TeamColor hah.BrickColor = player.TeamColor t1.BrickColor = player.TeamColor t2.BrickColor = player.TeamColor wait(.1) --Next Step: Activating Smoke-- sm1.Enabled = true sm2.Enabled = true sm3.Enabled = true sm4.Enabled = true --Step Three: Enabling Timer-- CapTime.Value = 0 ownervalue = "Raiders" while true do timevalue = CapTime.Value + 1 wait(1) end end end)