Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

can someone please help me with tweening a model pretty please?

Asked by 5 years ago

https://gyazo.com/8785e05347b36fc1d0fc03e25ae4eb80 im trying to tween a model but for some reason it glitches when closing

01local openDoor = script.Parent.Parent.Parent.DoorOpen
02local closeDoor = script.Parent.Parent.Parent.DoorClose
03local move = script.Parent.Parent.Move
04 
05local open = script.Parent.Parent.Open.Value
06 
07local clickdetector = script.Parent.ClickDetector
08 
09local tweenservice = game:GetService("TweenService")
10local tweeninfo = TweenInfo.new(
11            0.5,
12            Enum.EasingStyle.Quad,
13            Enum.EasingDirection.InOut,
14            0,
15            false,
View all 53 lines...

1 answer

Log in to vote
1
Answered by 5 years ago

The problem is that your using 2 if statements. The alternative is to combine them.

01clickdetector.MouseClick:Connect(function(plr)
02 
03    if not open then
04 
05        open = true
06 
07        tweenModel(script.Parent.Parent,openDoor:GetPrimaryPartCFrame())
08 
09    elseif open then
10 
11        open = false
12        tweenModel(script.Parent.Parent,closeDoor:GetPrimaryPartCFrame())
13 
14    end
15 
16end)

The reason it's glitchy was because after the first if-statement, the second if-statement ran.

0
thx ZorbaTheGreatGreek 59 — 5y
Ad

Answer this question