I'm making a sliding door that is supposed to print("test")
if newVal == 60
but for some reason it doesn't, although it does print("ran", newVal)
could someone please tell me why it doesn't detect if newVal == 60
? Here is the script (It is a server script inside of a part which is located in workspace):
local valueObj = game:WaitForChild("ServerStorage").ElevatorValues.Easy.Intermission valueObj.Changed:Connect(function(newVal) if newVal == 60 then print("test") for i=1, 100 do script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0.1, 0) wait() end elseif newVal == 10 then for i=1, 100 do script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, -0.1, 0) wait() end end print("ran", newVal) end)
If you have any idea why this isn't working please help!
Make sure the "newVal" variable received by the function is an integer, if it is an object, it will not work, or if it is a string, it must be converted to an integer.