Ge_inki
(Ge_inki)
August 11, 2021, 11:34am
#1
So I have a model of Sliding doors but I want to put it on my pillars and they down but when I put the script in the model the door goes down but model doesn’t.
https://gyazo.com/65cb76fecbfc3e13ca498ebfde16654e
The 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(7)
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)
Utk4_e
(Utk4_e)
August 11, 2021, 11:36am
#2
Have you tried doing this with “Attachment
” instead of script?
Ge_inki
(Ge_inki)
August 11, 2021, 11:37am
#3
No the script works, but it won’t attach.
Ge_inki
(Ge_inki)
August 11, 2021, 11:39am
#4
I think because it isn’t PartInstance
Utk4_e
(Utk4_e)
August 11, 2021, 11:40am
#5
It is possible to do this with Attachment
and HingeConstraint
. You do not need a script file. Related article:
Utk4_e
(Utk4_e)
August 11, 2021, 11:41am
#6
Do you want it to spin (move) only when the player passes the piece?
Ge_inki
(Ge_inki)
August 11, 2021, 11:42am
#7
No no, I need when you press a button 3 from the front and back go down and when pressed again it goes down.
Ge_inki
(Ge_inki)
August 11, 2021, 11:43am
#9
I don’t know, I really don’t know anything on scripting
Utk4_e
(Utk4_e)
August 11, 2021, 11:44am
#10
No problem. Give me about 5 minutes to do this
Ge_inki
(Ge_inki)
August 11, 2021, 11:45am
#11
Ok thanks, I really appreciate that.
Utk4_e
(Utk4_e)
August 11, 2021, 11:50am
#12
You want this to be animated
Ge_inki
(Ge_inki)
August 11, 2021, 11:50am
#13
Yes pls Tween, again I really appreciate it.
Ge_inki
(Ge_inki)
August 11, 2021, 11:54am
#14
So when it is done do I just put the script in the model?
Utk4_e
(Utk4_e)
August 11, 2021, 11:56am
#15
Yes, wait a minute. I will send it to you as soon as possible. You don’t need to wait.
1 Like
Utk4_e
(Utk4_e)
August 11, 2021, 12:05pm
#16
Put this on the part you want to tween.
put it in script
form. Let me know if there are any errors.
local tweenService = game:GetService("TweenService")
local part = script.Parent
local tweeningInformation = TweenInfo.new(
5, -- Length
Enum.EasingStyle.Bounce, -- Easing style
Enum.EasingDirection.Out, -- Easing direction
100, -- Number of times the tween will repeat
true, -- Should the tween repeat?
2 -- Delay between each tween
)
script.Parent.ProximityPrompt.TriggerEnded:Connect(function()
local partProperties = {
Size = Vector3.new(3.7, 5.1, 4);
Color = Color3.new(0.937255, 0.937255, 0.937255); --- Optional
Transparency = 0 --- Optional
}
local Tween = tweenService:Create(part,tweeningInformation,partProperties)
Tween:Play()
end)
Ge_inki
(Ge_inki)
August 11, 2021, 12:08pm
#17
How do I activate it? Because idk how
Utk4_e
(Utk4_e)
August 11, 2021, 12:09pm
#18
Make sure you add ProximityPrompt
.
Edit: You can set it according to itself via ProximityPrompt.
Ge_inki
(Ge_inki)
August 11, 2021, 12:11pm
#19
I added it but it isn’t going down (it is to the script or the model?)
Ge_inki
(Ge_inki)
August 11, 2021, 12:13pm
#20
And I want it connected to a button, any ideas?