I am currently working on this game project called “Classrooms” for around four months already, and it went through various development versions and most of them were old versions of the game that were scrapped. Anways, onto my issue:
I am currently making some furniture for the Classrooms, and I am making this “Projector Screen” thing that I do not understand how to tween properly. I am new to Roblox Scripting, yet my building skills are good. Here is my code (and a video) if you need it:
--Close
script.Parent.Parent.PullBar.Prox_Prompt.Triggered:Connect(function()
game:GetService("TweenService")
local info = TweenInfo.new(
6, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- Loop
false, -- Reverse
0 -- Delay
)
local tween = game:GetService("TweenService"):Create(script.Parent.Parent.Screen, info, { Size = Vector3.new(script.Parent.Parent.PullBar_Goal.Size.Y) })
local tween2 = game:GetService("TweenService"):Create(script.Parent.Parent.PullBar, info, { Position = Vector3.new(script.Parent.Parent.Screen_Goal.Position.Y) })
tween:Play()
tween2:Play()
task.wait(6)
tween:Cancel()
tween2:Cancel()
end)
--Open
--wip
you’re tweening just fine other than canceling the tween even though it would already be finished
local TS = game:GetService("TweenService")
local info = TweenInfo.new(6,Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
-- you aren't using Loop, Reverse, or Delay so just remove them
-- also keep TS and info outside of functions if you plan to reuse them
local Holder = script.Parent.Parent -- avoid typing 'script.Parent' so many times
local function Close()
-- you don't need to make variables for the tweens if you aren't reusing them
TS:Create(Holder.Screen, info, {Size = Holder.PullBar_Goal.Size}):Play()
TS:Create(Holder.PullBar, info, {Position = Holder.Screen_Goal.Position}):Play()
-- canceling isn't nessecary when the tween already finished
end
Holder.PullBar.Prox_Prompt.Triggered:Connect(Close)
The Screen to go upwards in size to the goal point (with no change to the X or Z sizes), with the Pull Bar staying on the screen. And I expect it to do it the opposite way while reopening it.
Actual behavior:
The Screen rapidly shrinking in size, not knowing where the goal is while the pull bar is going far outside of the room.
i had to put it in text format because the video wasn’t uploading to the dev forum