Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Tweening not working for door system?

Hello, I am currently creating a bank robbery system with a door system that requires you to input a code to open/close the vault door, however for some reason the door will not open or close, I had done a few prints and found that the event is firing correctly, however the tweening is not working for some reason, IsEnteringCode is a boolvalue found under replicatedstorage.bankinfo and the code is found in the same folder labeled as BankCode

-- Local Script

local gui = script.Parent
local frame = gui.Frame
local rs = game:GetService("ReplicatedStorage")
local events = rs.Events
local event = events.RobSystem
local DoorStatus = rs.BankInfo.DoorStatus.Value

script.Parent.Frame.SubmitButton.Activated:Connect(function()
    if DoorStatus == false and tonumber(frame.CodeBox.Text) == rs.BankInfo.VaultCode.Value then
        event:FireServer(false, true, tonumber(frame.CodeBox.Text), false, 0, 0)
        print("Fired event to open door")
    elseif DoorStatus == true and tonumber(frame.CodeBox.Text) == rs.BankInfo.VaultCode.Value then
        event:FireServer(false, true, tonumber(frame.CodeBox.Text), true, 0, 0)
        print("Fired event to close door")
end
end)
-- Server Script 

local BankVaultDoor
local vaultDoor = workspace.DestructibleDoors.VaultDoor
local BankVaultPanelRoot = vaultDoor
local PanelSlideInfo = TweenInfo.new()
local DoorClosedCFrame = BankVaultPanelRoot.CFrame
local DoorOpenCFrame = BankVaultPanelRoot.CFrame * CFrame.new(0, -13.5, 0)
local replicatedStorage = game:GetService('ReplicatedStorage')
local TweenService = game:GetService("TweenService")

events.RobSystem.OnServerEvent:Connect(function(IsRobbing, IsEnteringCode, EnteredCode, DoorStatus, Amount, robtime)
    if IsEnteringCode == true and IsRobbing == false then
        BankVaultDoor(EnteredCode, DoorStatus)
    elseif IsEnteringCode == false and IsRobbing == true then
        RobBank(Amount, robtime)
            end
end)

BankVaultDoor = function(EnteredCode, DoorStatus)
    if EnteredCode == replicatedStorage.BankInfo.VaultCode.Value and DoorStatus == false then
            print("Door opened")
            local PanelSlideTween = TweenService:Create(
                BankVaultPanelRoot, 
                PanelSlideInfo, 
                {
                    CFrame = DoorOpenCFrame
                })
            PanelSlideTween:Play()
        elseif DoorStatus == true then
            print("Door Closed")
            local PanelSlideTween = TweenService:Create(
                BankVaultPanelRoot, 
                PanelSlideInfo, 
                {
                    CFrame = DoorClosedCFrame
                })
            PanelSlideTween:Play()
        end
        DoorStatus = not DoorStatus
end

Any and all help is appreciated, I do however ask that you explain what I did wrong so I can learn from my mistakes, thanks in advance

2 comments

0

Does it output any errors?

0

No errors are thrown out

1 answer

It seems like you did not add any parameters for your tweenInfo, maybe that is the problem.

-- Server Script 

local BankVaultDoor
local vaultDoor = workspace.DestructibleDoors.VaultDoor
local BankVaultPanelRoot = vaultDoor
local PanelSlideInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingStyle.In) --Add parameters
local DoorClosedCFrame = BankVaultPanelRoot.CFrame
local DoorOpenCFrame = BankVaultPanelRoot.CFrame * CFrame.new(0, -13.5, 0)
local replicatedStorage = game:GetService('ReplicatedStorage')
local TweenService = game:GetService("TweenService")

events.RobSystem.OnServerEvent:Connect(function(IsRobbing, IsEnteringCode, EnteredCode, DoorStatus, Amount, robtime)
    if IsEnteringCode == true and IsRobbing == false then
        BankVaultDoor(EnteredCode, DoorStatus)
    elseif IsEnteringCode == false and IsRobbing == true then
        RobBank(Amount, robtime)
            end
end)

BankVaultDoor = function(EnteredCode, DoorStatus)
    if EnteredCode == replicatedStorage.BankInfo.VaultCode.Value and DoorStatus == false then
            print("Door opened")
            local PanelSlideTween = TweenService:Create(
                BankVaultPanelRoot, 
                PanelSlideInfo, 
                {
                    CFrame = DoorOpenCFrame
                })
            PanelSlideTween:Play()
        elseif DoorStatus == true then
            print("Door Closed")
            local PanelSlideTween = TweenService:Create(
                BankVaultPanelRoot, 
                PanelSlideInfo, 
                {
                    CFrame = DoorClosedCFrame
                })
            PanelSlideTween:Play()
        end
        DoorStatus = not DoorStatus
end

This discussion is preserved as it was. New answers, comments, and votes are closed.