The problem with your script is that you made a variable that included .Value, and used that variable for the changed event. You can’t use the Changed event on a Value Property. Remove that Value variable.
Here is your fixed script:
systemissue1 = script.Parent.Parent.Parent.Parent.Helicopter.Body.Avanta.Body.systemissue1
smokeL = systemissue1.Parent.Leftengine.Smokes
smokeR = systemissue1.Parent.Rightengine.Smokes
hits = script.Parent
hits.Changed:Connect(function()
if hits.Value > 60 then
smokeR.Parent.Leftengine.Smokes.Enabled = true
smokeL.Enabled = true
systemissue1:Play()
else
warn("Value not 60 yet")
end
end)
I don’t think you can used .Changed on the Value, instead you could do this:
hits.Changed:Connect(function()
if hits.Value > 60 then
smokeR.Parent.Leftengine.Smokes.Enabled = true
smokeL.Enabled = true
systemissue1:Play()
else
warn("Value not 60 yet")
end
end)
That should work!
EDIT: I just realised someone already solved it, I was late.
actually both of these fixes don’t seem to be working for me
(script is supposed to enable two smoke particle emitters and play a sound after the rotorblades of the helicopter hits a part 60+ times)
heres a clip of the issue
i am attempting to use the numbervalue’s value to detect when a particle emitter should be enabled (after the value is greater than 60, it should enable.) Also, i’ve not encountered any errors in console or anything in output.
systemissue1 = script.Parent.Parent.Parent.Parent.Helicopter.Body.Avanta.Body.systemissue1
smokeL = systemissue1.Parent.Leftengine.Smokes
smokeR = systemissue1.Parent.Rightengine.Smokes
hits = script.Parent
Value = hits.Value
while wait() do
if Value > 60 then
smokeR.Parent.Leftengine.Smokes.Enabled = true
smokeL.Enabled = true
systemissue1:Play()
else
warn("Value not 60 yet")
end
end
I have had the same issues in the past, This Seems To Fix It
Is the Value being changed from the Server or the Client? Maybe that could be the issue. If you are changing the Value on the Client, the Server will not detect the changes.
That’s what I was thinking but however it can run in to some problems by not continuing the rest of the code. So once the value is past 60, you need to break it. Usually I would also run it in a coroutine.
Using a while loop is not good practice, and could cause unnecessary lag if you do not break the loop. There is also another option where you could use GetPropertyChangedSignal. This can be used to detect any changes of a property
This is probably the last thing I could think of, maybe make those variables into local variables instead of global variables? I don’t think this would make any difference, but try and see:
local systemissue1 = script.Parent.Parent.Parent.Parent.Helicopter.Body.Avanta.Body.systemissue1
local smokeL = systemissue1.Parent.Leftengine.Smokes
local smokeR = systemissue1.Parent.Rightengine.Smokes
local hits = script.Parent
hits:GetPropertyChangedSignal("Value"):Connect(function()
if hits.Value > 60 then
smokeR.Parent.Leftengine.Smokes.Enabled = true
smokeL.Enabled = true
systemissue1:Play()
else
warn("Value not 60 yet")
end
end)