I have a big gate model that is all welded to one part and also unanchored.
For some reason, this does not seem to be opening. The value is changing and the prints do work, so I am unsure. There are no can-collide blocks in the way, and the “Moving” block has its front facing the direction it initially needs to move to open.
local TweenService = game:GetService("TweenService")
local part = script.Parent.Gate.Moving
script.Parent.Button.ClickDetector.MouseClick:Connect(function(plr)
if script.Parent.Opened.Value == false then
if plr.Team == game.Teams["Corrections Officer"] or plr.Team == game.Teams["Emergency Response Team"] then
print("opening")
local goal = {}
goal.CFrame = script.Parent.OpenGoal.CFrame
local info = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tween = TweenService:Create(part, info, goal)
tween:Play()
script.Parent.Opened.Value = true
end
else
if plr.Team == game.Teams["Corrections Officer"] or plr.Team == game.Teams["Emergency Response Team"] then
print("closing")
local goal = {}
goal.CFrame = script.Parent.ClosedGoal.CFrame
local info = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tween = TweenService:Create(part, info, goal)
tween:Play()
script.Parent.Opened.Value = false
end
end
end)
Any help would be appreciated.