Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i tween a model?

Hello i am attempting to make an elevator that tweens up floors and all but i have ran into a problem. so i followed https://devforum.roblox.com/t/introduction-to-tweening-models/315253 and i welded it all together with a weld constraints but Only the root part moved. i know this is something for dev forum but i can not access dev forum

Move Script

local TweenService = game:GetService("TweenService")
local Inside = script.Parent.Parent.Parent.Parent
local Root = Inside.PrimaryPart
local TInfo = TweenInfo.new(3,Enum.EasingStyle.Linear)
local goals = {Position = Vector3.new(-68.95, 17.55, 27.25)}

local floor2 = TweenService:Create(Root,TInfo,goals)

script.Parent.MouseButton1Click:Connect(function()
	floor2:Play()
end)

1 comment

0

Either use GetValue function of TweenService to recreate the tween manually, or make a dummy CFrameValue, tween its Value property, and use Changed/GetPropertyChangedSignal

2 answers

I don't think I'm sure of the issue, but try using my new code and see if that works. You should use the best Roblox script techniques available to you as they could better your chance at a working script.

local TweenService = game:GetService("TweenService")

local GuiButton = (script.Parent:IsA("GuiButton") and script.Parent) or script:FindFirstAncestorOfClass("GuiButton")
local Inside = script.Parent.Parent.Parent.Parent -- I suggest using script:FindFirstAncestor("")
local PrimaryPart = (Inside.PrimaryPart ~= nil and Inside.PrimaryPart)

if not PrimaryPart then print("PrimaryPart doesn't exist.") end;

GuiButton.MouseClick:Connect(function()
	local TweenInformation = TweenInfo.new(0,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0)
	local Tween = TweenService:Create(Inside,TweenInformation,{
		CFrame = CFrame.new(-68.95,17.55,27.25) * CFrame.Angles(math.rad(Inside.Orientation.X),math.rad(Inside.Orientation.Y),math.rad(Inside.Orientation.Z));
	})
end)

2 comments

0

i will test

0

Doesnt work

This discussion is preserved as it was. New answers, comments, and votes are closed.