is there a way I can make this script work along with the pivot the part has?
Heres my script:
script.Parent.Triggered:Connect(function()
script.Parent.ActionText = “Close”
local ts = game:GetService(“TweenService”)
local part = script.Parent.Parent
local info = TweenInfo.new(3, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out,0)
local properties = {CFrame = script.Parent.Parent.CFrame * CFrame.Angles(0,math.rad(90),0)}
local tween = ts:Create(script.Parent.Parent,info,properties)
tween:Play()
Here’s a tweening pivot script i made, it works off a click detector and could be more modular but you can modify it to your needs
local tweenService = game:GetService("TweenService")
local closeGoal = {Orientation = Vector3.new(90, script.Parent.RotPoint.Orientation.Y, script.Parent.RotPoint.Orientation.Z)}
local openGoal = {Orientation = Vector3.new(0, script.Parent.RotPoint.Orientation.Y, script.Parent.RotPoint.Orientation.Z)}
local open = true
local debounce = false
local tweenInfo = TweenInfo.new(3)
script.Parent.Part.ClickDetector.MouseClick:Connect(function(player)
print(player.Name.." Clicked!")
if open == true and debounce == false then
print("Closing!")
debounce = true
local tween = tweenService:Create(script.Parent.RotPoint, tweenInfo, closeGoal)
tween:Play()
tween.Completed:Connect(function()
open = false
debounce = false
print("Closed!")
end)
elseif open == false and debounce == false then
print("Opening!")
debounce = true
local tween = tweenService:Create(script.Parent.RotPoint, tweenInfo, openGoal)
tween:Play()
tween.Completed:Connect(function()
open = true
debounce = false
print("Opened!")
end)
end
end)