I’m trying to make a door system for my game… i used TweenService to try to make it work, but it didn’t… only the PrimaryPart (the Hinge) rotates - I used a Highlight to verify.
Any help is appreciated!
The script
local opened = false
local OpenSound = script.Parent.Parent.door_open
local CloseSound = script.Parent.Parent.door_close
local door = script.Parent.Door
function Open()
if opened == false then
opened = true
door.CanCollide = false
OpenSound:Play()
game:GetService("TweenService"):Create(script.Parent.PrimaryPart, TweenInfo.new(.5,Enum.EasingStyle.Bounce, Enum.EasingDirection.Out),{CFrame = script.Parent.PrimaryPart.CFrame*CFrame.Angles(0, math.rad(-96), 0)}):Play()
else
opened = false
CloseSound:Play()
game:GetService("TweenService"):Create(script.Parent.PrimaryPart, TweenInfo.new(.5,Enum.EasingStyle.Bounce, Enum.EasingDirection.Out),{CFrame = script.Parent.PrimaryPart.CFrame*CFrame.Angles(0, math.rad(-96), 0)}):Play()
door.CanCollide = true
end
end
script.Parent.Door.ProximityPrompt.Triggered:Connect(Open)
(I kinda think the script is a little unorganised)
You cant tween the whole model by just tweening the primary part. There are 2 simple ways. Either weld everything inside the model and then tween the primary part or tween a cframe value and change the cframe according to it per frame. There is also a post referencing the solution:
I also had to change what was the ‘primary part’ of each door to go from sliding to rotating, when doing this I had to make sure the new primary part was anchored, and that the old one was un-anchored.
So that might be your problem with yours, you can only have the primary part anchored, or at least thats how it works for me.
My PrimaryPart is the only thing anchored, but even with the model, I dont seem to find how to make the weld contrainst work… (also, sorry for late response)