As the title states. I tried doing Turned.Changed function but it wasn’t working either.
The code:
local play = true
local debounce = false
local Turned = game.ReplicatedStorage.Turned
while play do
task.wait()
if game.ReplicatedStorage.Turned.Value == true then
if not debounce then
debounce = true
script.Parent.BrickColor = BrickColor.new("Dark green")
game.ReplicatedStorage.Temp.Value += 1
task.wait(1)
debounce = false
end
else
script.Parent.BrickColor = BrickColor.new("Really red")
end
end
--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--//Variables
local Turned = ReplicatedStorage.Turned
local Part = script.Parent
--//Controls
local play = true
local debounce = false
--//Functions
local function ValueChanged()
print("Check1")
if not play then
return
end
print("Check2")
if Turned.Value then
if debounce then
return
end
print("Successful1")
debounce = true
Part.BrickColor = BrickColor.new("Dark green")
ReplicatedStorage.Temp.Value += 1
task.wait(1)
debounce = false
else
print("Successful2")
Part.BrickColor = BrickColor.new("Really red")
end
end
ValueChanged()
Turned:GetPropertyChangedSignal("Value"):Connect(function()
ValueChanged()
end)
I did a test with a script that was setting a value in replicated storage to true. I put that script on both workspace and server script service to test if it would work, and it wouldn’t. Neither would detecting if the value is true.