What do you want to achieve?
I want to make it so that when the player enters this decontamination-type room, the lights will turn red, it will play some demon scream sound effects and a bunny npc monster will appear, but I haven’t added the bunny yet, (basically a scary bit in a horror game).
What is the issue?
When I try to change the BrickColor for the lights, they stay as white, but the Demon Scream still plays and it changes if I manually change it without scripts.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Solutions I have tried so far is changing it to selecting from Hex, Color3 options, RGB, and have asked my other developer friends but they have no idea.
I can get images of the explorer and stuff if you need more information.
--Mainly focusing on the section with the light brickcolor changing to red--
local LockDownDoorSign = game.Workspace.LandScape.Decontamination.LockdownDoor1.Yellow
local LockDownRed = game.Workspace.LandScape.Decontamination.LockdownDoor1.Red
local YellowBack = game.Workspace.LandScape.Decontamination.LockdownDoor1.Door
local TriggerBrick = script.Parent.Parent.Parent.Parent.Parent.Trigger.TriggerPart
local Lights = script.Parent
local debounce1 = false
YellowBack.Transparency = 1
LockDownRed.Transparency = 1
LockDownDoorSign.Transparency = 1
YellowBack.CanCollide = false
LockDownRed.CanCollide = false
LockDownDoorSign.CanCollide = false
TriggerBrick.Touched:Connect(function(hit2)
if game.Players:GetPlayerFromCharacter(hit2.Parent) and debounce1 == false then
debounce1 = true
print("ScriptSuccess")
YellowBack.Transparency = 0
LockDownRed.Transparency = 0
LockDownDoorSign.Transparency = 0
YellowBack.CanCollide = true
LockDownRed.CanCollide = true
LockDownDoorSign.CanCollide = true
game.Workspace["Cave Ambience"]:Stop()
game.Workspace.Triggers.Slam:Play()
wait(5)
--Mainly focusing on this bit below--
if game.Workspace.Triggers["Demon Scream"]:Play() == false then
script.Parent.Light2.Light.BrickColor = BrickColor.new("Really red")
script.Parent.Light1.Light.BrickColor = BrickColor.new("Really red")
script.Parent.Light4.Light.BrickColor = BrickColor.new("Really red")
script.Parent.Light3.Light.BrickColor = BrickColor.new("Really red")
game.Workspace.Triggers["Demon Scream"]:Play()
end
end
end)
Are you able to tell us what the instanceType of script.Parent.Light2.Light is? Is it a Part or a light? If it’s a light then you need to change the ‘Color’ Value of the light
It’s a part, but replying about how to fix it as a light would also help. Basically, I’m changing the color of the part but it has a point light inside of it.
OHHHH I found out what’s wrong!
It turns out that with the if game.Workspace.Triggers["Demon Scream"]:Play() == false then,
that “Play” can never be false, because it’s a command. if game.Workspace.Triggers["Demon Scream"].Playing == false then. If I replace it with this instead, it’s saying that if it’s not playing, to play it.
So with the original chunk of code, it was impossible to check if it is ‘Play,’ because Play is returning a function, but with ‘Playing,’ it’s checking if the demon scream is playing, not if it’s ‘play’