I want the TV to turn off after the Mortimer spawns in, but it isn’t working. I’m trying to do it via remote event.
Main script:
-- Get necessary services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local Workspace = game:GetService("Workspace")
-- Wait for values and event to be available
local TVone = ReplicatedStorage:WaitForChild("TVone")
local TVtwo = ReplicatedStorage:WaitForChild("TVtwo")
local TVthree = ReplicatedStorage:WaitForChild("TVthree")
local mortimerRedoEvent = ReplicatedStorage:WaitForChild("MortimerRedo")
-- Clone target from ServerStorage
local objectToClone = ServerStorage:WaitForChild("SurvivalTheMortimerTheKiller")
-- Function to check and handle all TV values being true
local function checkAllTVs()
print("Checking TVs:", TVone.Value, TVtwo.Value, TVthree.Value)
if TVone.Value and TVtwo.Value and TVthree.Value then
print("All TVs true, cloning objects")
for i = 1, 5 do
local clone = objectToClone:Clone()
clone.Parent = Workspace
clone.Position = Vector3.new(0, 50 * i, 0)
end
mortimerRedoEvent:Fire()
TVone.Value = false
TVtwo.Value = false
TVthree.Value = false
print("TVs reset:", TVone.Value, TVtwo.Value, TVthree.Value)
end
end
-- Connect Changed events to react immediately when any TV value changes
TVone.Changed:Connect(checkAllTVs)
TVtwo.Changed:Connect(checkAllTVs)
TVthree.Changed:Connect(checkAllTVs)
-- Optional: initial check in case all TVs start true
checkAllTVs()
TV script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TVthree = ReplicatedStorage:WaitForChild("TVone")
local MortimerRedo = ReplicatedStorage:WaitForChild("MortimerRedo")
local isOn = false
local screen = script.Parent.Parent:WaitForChild("screen")
local clickDetector = script.Parent:WaitForChild("ClickDetector")
local function on()
isOn = true
screen.Material = Enum.Material.Neon
screen.BrickColor = BrickColor.new("Institutional white")
if screen:FindFirstChild("Sound") then
screen.Sound.Playing = true
end
TVthree.Value = true
end
local function off()
isOn = false
screen.Material = Enum.Material.Glass
screen.BrickColor = BrickColor.new("Really black")
if screen:FindFirstChild("Sound") then
screen.Sound.Playing = false
end
TVthree.Value = false
end
clickDetector.MouseClick:Connect(function()
if isOn then
off()
else
on()
end
end)
MortimerRedo.Event:Connect(function()
off()
end)
off()