Hello Devforum, I’m trying to make this trailer support move up and down smoothly, but I can’t seem to get it to work. (Probably because it has to be unanchored)
How would I go on about doing this?
Here’s my code:
local ts = game:GetService("TweenService")
local foot = script.Parent.Foot
local FootDown = script.Parent.FootDown
local FootUp = script.Parent.FootUp
local handle = script.Parent.Handle.Handle
local Up = true
local tweenInfo = TweenInfo.new(
5,
Enum.EasingStyle.Quint,
Enum.EasingDirection.Out,
0,
false,
0
)
local DownGoals = {
Position = FootDown.Position
}
local UpGoals = {
Position = FootUp.Position
}
handle.ClickDetector.MouseClick:Connect(function()
handle.ClickDetector.MaxActivationDistance = 0
if Up == true then
local DownTween = ts:Create(foot, tweenInfo, FootDown.Position)
DownTween:Play()
Up = false
else
local UpTween = ts:Create(foot, tweenInfo, FootUp.Position)
UpTween:Play()
Up = true
end
wait(5)
handle.ClickDetector.MaxActivationDistance = 32
end)
local ts = game:GetService("TweenService")
local foot = script.Parent.Foot
local FootDown = script.Parent.FootDown
local FootUp = script.Parent.FootUp
local handle = script.Parent.Handle.Handle
local Up = true
local tweenInfo = TweenInfo.new(
5,
Enum.EasingStyle.Quint,
Enum.EasingDirection.Out,
0,
false,
0
)
local DownGoals = {
Position = FootDown.Position
}
local UpGoals = {
Position = FootUp.Position
}
handle.ClickDetector.MouseClick:Connect(function()
handle.ClickDetector.MaxActivationDistance = 0
if Up == true then
local DownTween = ts:Create(foot, tweenInfo, DownGoals)
DownTween:Play()
Up = false
else
local UpTween = ts:Create(foot, tweenInfo, UpGoals)
UpTween:Play()
Up = true
end
wait(5)
handle.ClickDetector.MaxActivationDistance = 32
end)
local DownTween = ts:Create(foot, tweenInfo, {Position = FootUp.Position})
Basically this is the same thing that @Mortai_Yt (and I) changed but it’s not saved in a variable (so it might not give you the “unable to cast to dictionary” error).
local ts = game:GetService("TweenService")
local foot = script.Parent.Foot
local FootDown = script.Parent.FootDown
local FootUp = script.Parent.FootUp
local handle = script.Parent.Handle.Handle
local Up = true
local tweenInfo = TweenInfo.new(
5,
Enum.EasingStyle.Quint,
Enum.EasingDirection.Out,
0,
false,
0
)
local DownGoals = {
['Position'] = FootDown.Position
}
local UpGoals = {
['Position'] = FootUp.Position
}
handle.ClickDetector.MouseClick:Connect(function()
handle.ClickDetector.MaxActivationDistance = 0
if Up == true then
local DownTween = ts:Create(foot, tweenInfo, DownGoals)
DownTween:Play()
Up = false
else
local UpTween = ts:Create(foot, tweenInfo, UpGoals)
UpTween:Play()
Up = true
end
wait(5)
handle.ClickDetector.MaxActivationDistance = 32
end)
Yes, It is welded to the Base of the support.
But I might make it differently since I didn’t expect it to be such a pain.
Thank you for the effort though.