Hello guys, so I need help with this problem right there. When I click the “doors down” button, I get an error instead of the doors/windows going down. Here is a video:
Here are the scripts involved:
Doors Script:
local rs = game:GetService("ReplicatedStorage")
local tweens = game:GetService("TweenService")
local event = rs.cubicleDoorControl
local RCS = require(rs.RoundControlStorage)
local doorDown = game.Workspace.doorDown
local downYPosition = 1520.844
local upYPosition = 1540.594
event.OnServerEvent:Connect(function()
local doors = RCS.Doors
if doorDown.Value == false then
for _, door in pairs(doors) do
local downCFrame = door.CFrame
downCFrame.Y = downYPosition
tweens:Create(door, TweenInfo.new(1.2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {["CFrame"] = downCFrame}):Play()
end
elseif doorDown.Value == true then
for _, door in pairs(doors) do
local upCFrame = door.CFrame
upCFrame.Y = upYPosition
tweens:Create(door, TweenInfo.new(1.2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {["CFrame"] = upCFrame}):Play()
end
end
end)
Button Script:
local rs = game:GetService("ReplicatedStorage")
local event = rs.cubicleDoorControl
local button = script.Parent
local defaultText = button.Text
local doorDown = game.Workspace.doorDown
script.Parent.MouseButton1Up:Connect(function()
event:FireServer()
if doorDown.Value == false then
doorDown.Value = true
elseif doorDown.Value == true then
doorDown.Value = false
end
local debounce = 3
while debounce ~= 0 do
button.Text = tostring(debounce)
debounce -= 1
task.wait(1)
end
button.Text = defaultText
end)
Modulescript:
local RCS = {}
local cubicles = game.Workspace.cubicles
RCS.V3s = {
Vector3.new(105.656, 1540.594, 70.875),
Vector3.new(105.656, 1540.594, 35.438),
Vector3.new(35.437, 1540.594, 105.656),
Vector3.new(70.875, 1540.594, 105.656),
Vector3.new(105.656, 1540.594, -70.875),
Vector3.new(105.656, 1540.594, -35.437),
Vector3.new(-105.656, 1540.594, -35.438),
Vector3.new(0, 1540.594, 105.656),
Vector3.new(-35.438, 1540.594, 105.656),
Vector3.new(-35.437, 1540.594, -105.656),
Vector3.new(0, 1540.594, -105.656),
Vector3.new(-105.656, 1540.594, 35.437),
Vector3.new(-70.875, 1540.594, -105.656),
Vector3.new(35.438, 1540.594, -105.656),
Vector3.new(70.875, 1540.594, -105.656),
Vector3.new(-105.656, 1540.594, -70.875),
Vector3.new(-105.656, 1540.594, 70.875),
Vector3.new(-70.875, 1540.594, 105.656)
}
RCS.Doors = {
cubicles.cubicle1.cubicleWindow,
cubicles.cubicle2.cubicleWindow,
cubicles.cubicle3.cubicleWindow,
cubicles.cubicle4.cubicleWindow,
cubicles.cubicle5.cubicleWindow,
cubicles.cubicle7.cubicleWindow,
cubicles.cubicle8.cubicleWindow,
cubicles.cubicle9.cubicleWindow,
cubicles.cubicle10.cubicleWindow,
cubicles.cubicle11.cubicleWindow,
cubicles.cubicle12.cubicleWindow,
cubicles.cubicle14.cubicleWindow,
cubicles.cubicle15.cubicleWindow,
cubicles.cubicle16.cubicleWindow,
cubicles.cubicle17.cubicleWindow,
cubicles.cubicle18.cubicleWindow,
cubicles.cubicle19.cubicleWindow,
cubicles.cubicle20.cubicleWindow
}
return RCS
I would appreciate some help! Thanks!