Greetings Developers.
I wanted to make a Slide Door using a ClickDetector and a tweening script with CFrame. Before i added the ClickDetector elements in the script, the tween worked without problem but now it doesnt tween when i click the detector. There is no error in the output while clicking.
Me, being a beginner scripter, can’t see whats wrong here…
Here is the script :
local TweenService = game:GetService("TweenService")
local Panel = workspace.SlidingDoor
local PanelRoot = Panel.PrimaryPart
local PanelSlideInfo = TweenInfo.new() -- Let's use all defaults here
local button = Panel.Part.ClickDetector
local open = false
button.MouseClick:Connect(function()
if open == false then
local PanelSlideTween = TweenService:Create(PanelRoot, PanelSlideInfo, {
CFrame = PanelRoot.CFrame * CFrame.new(PanelRoot.Size.X + 0, 0, 5.3)
})
PanelSlideTween:Play()
open = true
else
local PanelSlideTween = TweenService:Create(PanelRoot, PanelSlideInfo, {
CFrame = PanelRoot.CFrame * CFrame.new(PanelRoot.Size.X + 0, 0, -5.3)
})
PanelSlideTween:Play()
end
end)
Thank you everyone for helping