huanwz
(Huan)
June 18, 2021, 9:06pm
#1
Hey! I was tweening something but the tween doesn’t play, there is nothing in output but the script ran whole. I don’t know what is happening, anyone can help?
Here is a video:
https://i.gyazo.com/95a619cb7f0c1de3d31d3eecde1d474a.mp4
Here is the script:
local TweenService = game:GetService("TweenService")
local hinge = script.Parent.Hinge
local prompt = script.Parent.Top.PromptAttachment.Prompt
local tweenInfo = TweenInfo.new(
2,
Enum.EasingStyle.Quint,
Enum.EasingDirection.Out,
0,
true,
1
)
local tweenOpen = TweenService:Create(hinge, tweenInfo, {
CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)
})
local tweenClose = TweenService:Create(hinge, tweenInfo, {
CFrame = hinge.CFrame * CFrame.Angles(math.rad(0), 0, 0)
})
prompt.Triggered:Connect(function()
if prompt.ActionText == "Close" then
tweenClose:Play()
prompt.ActionText = "Open"
else
tweenOpen:Play()
prompt.ActionText = "Close"
end
end)
cowwy_yt
(cowwy_yt)
June 18, 2021, 9:09pm
#2
I am not exactly sure if you can Tween a CFrame like that.
huanwz
(Huan)
June 18, 2021, 9:11pm
#3
I found a couple of tutorials on Youtube and it worked for them.
It seems like you are only rotating the hinge but not the box (according to your variable names) did you weld the lid to the hinge or anything?
also this line is not doing anything
cowwy_yt
(cowwy_yt)
June 18, 2021, 9:14pm
#5
local TweenService = game:GetService("TweenService");
local Wall = script.Parent;
local duration = 5.0;
local easingStyle = Enum.EasingStyle.Linear;
local direction = Enum.EasingDirection.In;
local repeatCount = 0;
local reverse = true;
local dTime = 0;
local Info =
TweenInfo.new( duration, easingStyle, direction, repeatCount, reverse, dTime );
local Goals = {
-- Position = Vector3.new( 0, 20, 0 );
CFrame = CFrame.new( 0, 20, 0 );
}
local movePart = TweenService:Create( Wall, Info, Goals );
wait( 4 );
movePart:Play( );
So I tested it out. The CFrame definitely works.
As to why it doesn’t work for you.
Maybe you post the workspace hierarchy of the object so we can see what you have added in there.
huanwz
(Huan)
June 18, 2021, 9:15pm
#6
I weld the hinge to the top part, yes.
What do you also mean by “not the box”?
I think it’s to press the E button for a few seconds
huanwz
(Huan)
June 18, 2021, 9:21pm
#9
I did trigger the E button, it works