You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want the UI to pop up if the player is lower than 6 in the group, otherwise, I want the projector to run. -
What is the issue? Include screenshots / videos if possible!
The remote event is firing instead of running one of running the first two if statements.
local projectorSCREEN = game.Workspace.ProjectorScreen
local projector = game.Workspace.Projector
local TV = game.Workspace.TVScreen
local projectorLight = projector.LightPart.SpotLight
local TVLight = TV.TVLightPart
local projectorSCREENLight = projectorSCREEN.ProjectorLight
local repStorage = game:GetService("ReplicatedStorage")
local errorEvent = repStorage.ErrorFolder.ErrorEvent1
local errorMessage = "You must be Staff Sergeant+ to use this."
-- Gun Videos:
local tvGun = TV.Screen.SurfaceGui.GunVideo
local projectorGun = projectorSCREEN.Screen.SurfaceGui.GunVideo
-- Gun Videos ^
-- Static Vid:
local TVstaticVideo = TV.Screen.SurfaceGui.StaticVideo
local projectorStatic = projectorSCREEN.Screen.SurfaceGui.StaticVideo
-- Static Vid ^
local isOFF = false
script.Parent.Triggered:Connect(function(Player)
print("Activated")
local rank = Player:GetRankInGroup(14289900)
if rank >= 6 and isOFF == true then
print(Player.Name .. "Activated/Deactivated the projector.")
isOFF = false
script.Parent.ActionText = "Turn On"
TVLight.BrickColor = BrickColor.new("Really red")
projectorSCREENLight.BrickColor = BrickColor.new("Really red")
projectorLight.Enabled = false
projectorLight.Parent.Material = Enum.Material.Glass
tvGun.Playing = false
tvGun.Visible = false
projectorGun.Playing = false
projectorGun.Visible = false
-- turned off gun videos ^^
TVstaticVideo.Visible = true
TVstaticVideo.Playing = true
projectorStatic.Visible = true
projectorStatic.Playing = true
-- Played static ^^
wait(.5)
TVstaticVideo.Playing = false
TVstaticVideo.Visible = false
projectorStatic.Visible = false
projectorStatic.Playing = false
-- ended static ^^
elseif isOFF == true and rank >= 6 then
script.Parent.ActionText = "Turn Off"
TVstaticVideo.Visible = true
TVstaticVideo.Playing = true
projectorStatic.Visible = true
projectorStatic.Playing = true
wait(.5)
projectorStatic.Visible = false
projectorStatic.Playing = false
TVstaticVideo.Playing = false
TVstaticVideo.Visible = false
-- Played and ended static ^^
projectorGun.Playing = true
projectorGun.Visible = true
tvGun.Playing = true
tvGun.Visible = true
TVLight.BrickColor = BrickColor.new("Lime green")
projectorLight.Enabled = true
projectorLight.Parent.Material = Enum.Material.Neon
projectorSCREENLight.BrickColor = BrickColor.new("Lime green")
else
errorEvent:FireAllClients(errorMessage)
end
end)
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve looked over this script so many times, but haven’t been able to find the issue.
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.