You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want my model to tween his position vertically
-
What is the issue? When i click play my model teleports to the top with out animation
-
What solutions have you tried so far? Searched for people with the same issue and it didnt work, tried tweening primary part, tried :MoveTo, and tried point a to point b.
one thing to mention my tween activates by proximity prompt
here is the code
local button = script.Parent.Parent
local model = button.Parent
local goal = CFrame.new(264.272, 2064.5, 1583.295)
local promt = script.Parent
local main = model.Part_up
local tween = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(
15,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local changes = {
model:PivotTo(main.CFrame)
}
local tweencreate = tween:Create(model,tweeninfo,changes)
promt.Triggered:Connect(function(plr)
promt.Enabled = false
tweencreate:Play()
end)
2 Likes
I don’t think you can tween a Model without tweening its PrimaryPart
I suggest tweening the model’s Primarypart by changing Create(model,) to Create(model.PrimaryPart
and then,
in the changes table, replace model:PivotTo(main.CFrame) to CFrame = main.CFrame
i already tried this sorry i will edit post and really show what i already tried
g.play.MouseButton1Down:Connect(function()
local d = Instance.new('CFrameValue')
d.Value = workspace.Model.WorldPivot
d:GetPropertyChangedSignal('Value'):Connect(function()
workspace.Model:PivotTo(d.Value)
end)
local Goal = CFrame.new(0,10,0)
if not t or (t and t.PlaybackState == Enum.PlaybackState.Completed) then
t = s:Create(d,TweenInfo.new(1,Enum.EasingStyle.Quint, Enum.EasingDirection.Out),{Value = Goal})
end
t:Play()
end)
this is rushed because but you get the point
Instead of Tweening you can do this, much smoother than tweening a player character
local startpos = Model:GetPivot()
local goalpos = -- some CFrame goal
local function ModelTween(Model, start_pos, goal, duration)
local lapsed = 0
local curr_pos = start_pos
local Handle = RunS.Heartbeat:Connect(function(step)
curr_pos = start_pos:Lerp(goal, lapsed / duration)
Model:PivotTo(curr_pos)
lapsed += step
end)
task.spawn(function()
while task.wait(1) do
if lapsed >= duration then
Handle:Disconnect()
Model.PrimaryPart.AssemblyLinearVelocity = Vector3.zero
-- set this if your Model flies away
-- due to accumulated velocity from gravity
end
end
end)
end
-- call a 5 second tween
ModelTween(Model, startpos, goalpos, 5)
1 Like
i honestly give up on this. i tried every solution and nothing worked
Did you try mine, mine works just fine