My Script isn’t being read at all anyone know what could be causing it?
print("Script Check")
if script.Parent.Touch.Value > 1 then
print(“Touch value checked”)
for i=1,script.Parent.Size.Y/25 do
print(“les go2”)
script.Parent.Parent.Door.CFrame = script.Parent.Parent.Door.CFrame+Vector3.new(0,.9,0)
end
end
If you add an else and print the value will it print?
if script.Parent.Touch.Value > 1 then
print(“Touch value checked”)
for i=1,script.Parent.Size.Y/25 do
print(“les go2”)
script.Parent.Parent.Door.CFrame = script.Parent.Parent.Door.CFrame+Vector3.new(0,.9,0)
end
else
print(script.Parent.Touch.Value)
end
Well I see you’re lerping for a door animation. I believe you want to add an interval:
print('This script is running.')
local basePart = script.Parent
local doorPart = basePart.Parent:WaitForChild('Door')
local touchValue = basePart:WaitForChild('Touch')
local doorInterval = 0.1 --- Larger numbers are slower, smaller numbers are faster.
local function onTouchValueChanged()
if touchValue.Value > 1 then
print('The Touch value is over 1.')
for i = 1, basePart.Size.Y / 25, 1 do
doorPart.CFrame *= CFrame.new(0, 0.9, 0)
task.wait(doorInterval)
end
end
end
onTouchValueChanged()
touchValue:GetPropertyChangedSignal('Value'):Connect(onTouchValueChanged)
Based on your parameters for the loop, I assume the door is very large. If you want this to happen whenever the Value property of the Touch value is changed, then you should connect it to the changed signal.
If this part of the code is incorrect, and I believe it is based on the context, you should make this number smaller. If you do not want a connection for this then you can just remove it, but if you want it to happen only once and when the Touch value is changed, add a debounce-esque mechanic here.
You need to tell it to look for the changes. So try this but change the part to your part.
local part = workspace.LevelStart
local touch = part.Touch
local function check()
if touch.Value > 1 then
print("Touch value checked")
for i=1,script.Parent.Size.Y/25 do
print("les go2")
script.Parent.Parent.Door.CFrame = script.Parent.Parent.Door.CFrame+Vector3.new(0,.9,0)
end
else
print(script.Parent.Touch.Value)
end
end
touch:GetPropertyChangedSignal("Value"):Connect(check)