Hello there, I tried to call a function using an if statement instead of the commonly used method, but it isn't working, how do I fix this? This is the code (Note that this is in LocalScript):
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CaptureEvent = ReplicatedStorage:WaitForChild("CaptureEvent")
local TeleportPart = game.Workspace.TeleportPart
local plr = game:GetService("Players").LocalPlayer
local function trigger()
plr.PlayerGui.AllyGui.Button.LocalScript.Disabled = false
plr.PlayerGui.AllyGui.TeamOnlyGuiScript.Disabled = false
plr.PlayerGui.CentralGui.Enabled = false
CaptureEvent:FireServer(TeleportPart)
end
if TeleportPart.BrickColor == BrickColor.new("Maroon") then
trigger()
end

2 comments
BrickColor.Changed does not exist. You're looking for Instance:GetPropertyChangedSignal
I never knew that thanks, I'll edit the answer now.