Ge_inki
(Ge_inki)
August 11, 2021, 2:02pm
#1
Hi, I followed a tutorial of tweening and it worked but I need them to all go down any ideas
Script :
local TweenService = game:GetService(“TweenService”)
local model = script.Parent
local leftDoor = model.LeftDoor
local rightDoor = model.RightDoor
local prompt = model.Top.Attachment.ProximityPrompt
local tweenInfo = TweenInfo.new(1)
local leftGoalOpen = {}
local leftGoalClose = {}
leftGoalOpen.CFrame = leftDoor.CFrame * CFrame.new(leftDoor .Size.X, 0, 0)
leftGoalClose.CFrame = leftDoor.CFrame
local leftTweenOpen = TweenService:Create(leftDoor, tweenInfo, leftGoalOpen)
local leftTweenClose = TweenService:Create(leftDoor, tweenInfo, leftGoalClose)
local rightGoalOpen = {}
local rightGoalClose = {}
rightGoalOpen.CFrame = rightDoor.CFrame * CFrame.new(-rightDoor .Size.X, 0, 0)
rightGoalClose.CFrame = rightDoor.CFrame
local rightTweenOpen = TweenService:Create(rightDoor, tweenInfo, rightGoalOpen)
local rightTweenClose = TweenService:Create(rightDoor, tweenInfo, rightGoalClose)
prompt.Triggered:Connect(function()
if prompt.ActionText ==“Close” then
leftTweenClose:Play{}
rightTweenClose:Play{}
prompt.ActionText = “Open”
else
leftTweenOpen:Play{}
rightTweenOpen:Play{}
prompt.ActionText = “Close”
end
end)
2 Likes
Bikereh
(green_lady)
August 11, 2021, 2:06pm
#2
So do you want the tweens to bring the parts down? Or do you mean play the tweens.
Ge_inki
(Ge_inki)
August 11, 2021, 2:07pm
#3
I want to make the tweens go down.
Bikereh
(green_lady)
August 11, 2021, 2:08pm
#4
I think you need to change {}
to ()
when you want to play the tweens.
1 Like
Ge_inki
(Ge_inki)
August 11, 2021, 2:09pm
#5
I tried that and now it won’t move, and there is a red underline under it.
Bikereh
(green_lady)
August 11, 2021, 2:10pm
#6
Check the output, are there any errors?
Ge_inki
(Ge_inki)
August 11, 2021, 2:11pm
#7
There are red underlines under the () now
Bikereh
(green_lady)
August 11, 2021, 2:12pm
#8
Did you change
local leftGoalOpen = {}
local leftGoalClose = {}
local rightGoalOpen = {}
local rightGoalClose = {}
to
local leftGoalOpen = ()
local leftGoalClose = ()
local rightGoalOpen = ()
local rightGoalClose = ()
Ge_inki
(Ge_inki)
August 11, 2021, 2:14pm
#9
Bikereh
(green_lady)
August 11, 2021, 2:15pm
#10
Use this:
local TweenService = game:GetService("TweenService")
local model = script.Parent
local leftDoor = model.LeftDoor
local rightDoor = model.RightDoor
local prompt = model.Top.Attachment.ProximityPrompt
local tweenInfo = TweenInfo.new(1)
local leftGoalOpen = {}
local leftGoalClose = {}
leftGoalOpen.CFrame = leftDoor.CFrame * CFrame.new(leftDoor .Size.X, 0, 0)
leftGoalClose.CFrame = leftDoor.CFrame
local leftTweenOpen = TweenService:Create(leftDoor, tweenInfo, leftGoalOpen)
local leftTweenClose = TweenService:Create(leftDoor, tweenInfo, leftGoalClose)
local rightGoalOpen = {}
local rightGoalClose = {}
rightGoalOpen.CFrame = rightDoor.CFrame * CFrame.new(-rightDoor .Size.X, 0, 0)
rightGoalClose.CFrame = rightDoor.CFrame
local rightTweenOpen = TweenService:Create(rightDoor, tweenInfo, rightGoalOpen)
local rightTweenClose = TweenService:Create(rightDoor, tweenInfo, rightGoalClose)
prompt.Triggered:Connect(function()
if prompt.ActionText == "CLose" then
leftTweenClose:Play()
rightTweenClose:Play()
prompt.ActionText = "Open"
else
leftTweenOpen:Play()
rightTweenOpen:Play()
prompt.ActionText = "CLose"
end
end)
1 Like
Ge_inki
(Ge_inki)
August 11, 2021, 2:17pm
#11
That’s the same script but without the line in the middle.
Bikereh
(green_lady)
August 11, 2021, 2:19pm
#12
Did you try using the script or not?
Ge_inki
(Ge_inki)
August 11, 2021, 2:20pm
#13
Yes I did and the same error happened
Bikereh
(green_lady)
August 11, 2021, 2:20pm
#14
can i you send me your script please
Ge_inki
(Ge_inki)
August 11, 2021, 2:21pm
#15
Ok sure “I need 30 words to type a reply”
Ge_inki
(Ge_inki)
August 11, 2021, 2:38pm
#16
Are you still doing the script?
hurzell
(hurzell)
August 11, 2021, 3:47pm
#17
There isn’t much information for people to go off of, can you show the layout of your doors and where the scripts are? The more info the easier it becomes for everyone else!
Also, i believe it is unnecessary to create both open and closed goals if only one will be used, instead you should use conditionals to make one for each instead of two!