I am trying to get a door to open with a position-tween using a proximity prompt, this script does not work and I can’t find the issue.
Here is the script ^
Help is very much appreciated
I am trying to get a door to open with a position-tween using a proximity prompt, this script does not work and I can’t find the issue.
Help is very much appreciated
Are there any errors, add a print before the tween creation to see if the prompt is being triggered
It does not get triggered, not even a print.
Can we have a screen shot of the explorer where the prompt is
Sure thing!
Uh can you print the script so I can edit it?
Yep!
local P1 = script.Parent.Parent.Parent.Parent.Door.P1
local P2 = script.Parent.Parent.Parent.Parent.Door.P2
local TweenService = game:GetService(“TweenService”)
–Tween for → opening ←
local Opengoal = {
position = Vector3.new(0, 6.5, 0)
}
local OpentweenInfo = TweenInfo.new(
3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
0,
false,
0
)
local OpenTweenP1 = TweenService:Create(P1, OpentweenInfo, Opengoal)
local OpenTweenP2 = TweenService:Create(P2, OpentweenInfo, Opengoal)
local function Open()
OpenTweenP1:Play()
OpenTweenP2:Play()
end
script.Parent.Triggered:Connect(function()
print(“Door Triggered.”)
end)
The event that happens when it gets triggered is set to a print, but that does not work
Here is the formatted btw:
local P1 = script.Parent.Parent.Parent.Parent.Door.P1
local P2 = script.Parent.Parent.Parent.Parent.Door.P2
local TweenService = game:GetService(“TweenService”)
local Opengoal = {
position = Vector3.new(0, 6.5, 0)
}
local OpentweenInfo = TweenInfo.new(
3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
0,
false,
0
)
local OpenTweenP1 = TweenService:Create(P1, OpentweenInfo, Opengoal)
local OpenTweenP2 = TweenService:Create(P2, OpentweenInfo, Opengoal)
local function Open()
OpenTweenP1:Play()
OpenTweenP2:Play()
end
script.Parent.Triggered:Connect(function()
print(“Door Triggered.”)
end)
How can you do that? Sorry I don’t really know it
You can either click this
or type
--Code here
Are you sure it’s not printing? Nothing at all in output?
Nothing at all, no. I’ve tried it in the same way without all of the stuff that has to do with tweening and it worked.
So the printing works if you delete all the other code?
It does if I delete all the codes except for the actual triggering and printing part
Im just massively confused, Not even when I do this:
while true do
OpenTween(Both 1 and 2):Play
end)
Try this:
local TweenService = game:GetService("TweenService")
local Opengoal = {
position = Vector3.new(0, 6.5, 0)
}
local OpentweenInfo = TweenInfo.new(
3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
0,
false,
0
)
local P1 = workspace.Door.Door:WaitForChild("P1")
local P2 = workspace.Door.Door:WaitForChild("P2")
script.Parent.Triggered:Connect(function()
TweenService:Create(P1, OpentweenInfo, Opengoal):Play()
TweenService:Create(P2, OpentweenInfo, Opengoal):Play()
end)
Sorry I should have seen the typo haha
position = Vector3.new(0, 6.5, 0)
With
Position = Vector3.new(0, 6.5, 0)
Yes! It works! I only made a small mistake, I needed the door to go up by 6.5 and not towards 6.5 itself, but I should be able to do that, I’ll keep you updated, Appreciated
All good! If you need a hint tell me