local PressurePlate = script.Parent
local Door = PressurePlate.Parent.XRayPart
local TargetPos = Vector3.new(-33.023, 0.225, 287.778)
local Pos = Vector3.new(-41.023, 0.225, 287.778)
local TS = game:GetService("TweenService")
local TI = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
function MovingScript()
local T1 = TS:Create(Door, TI, {Position = TargetPos})
T1:Play()
end
script.Parent.Touched:Connect(MovingScript)
while true do
wait(0.1)
if Door.Position == TargetPos then
local T2 = TS:Create(Door, TI, {Position = Pos})
T2:Play()
end
end
so i have a cube and when it touches the pressure plate i want it to do function moving scriptbut for some reason it only fires when its the character touching it. help?
