work on closing doors

This commit is contained in:
2024-02-10 16:10:35 -05:00
parent 699fe50fea
commit c454a5cc4e
6 changed files with 21 additions and 15 deletions

View File

@@ -57,7 +57,7 @@ end
HumanoidSettings:SetWalkSpeed()
HumanoidSettings:SetJumpHeight()
HRPSettings:DisableRobloxSounds()
CameraConsturctor:EnableBobbing()
-- CameraConsturctor:EnableBobbing()
SpineMovement:Enable()
CrouchFeature()

View File

@@ -44,7 +44,7 @@ local function CameraBinds()
end
CoreGuis:Off()
Camera:FirstPerson()
-- Camera:FirstPerson()
Mouse:DisablePointer()
Crosshair:Enable()

View File

@@ -10,6 +10,9 @@ local Storage = game:GetService("ReplicatedStorage")
local Tween = require(Storage:WaitForChild("Tween"))
local Tags = require(Storage:WaitForChild("Tags"))
local Door1Stopped_X = Vector3.xAxis*2.9
local Door2Stopped_X = Vector3.xAxis*6
function Doors.constructor(ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder)
local DoorTween1 = Tween.constructor(nil, ElevatorDoor1)
local DoorTween2 = Tween.constructor(nil, ElevatorDoor2)
@@ -28,23 +31,23 @@ function Doors.constructor(ElevatorBox: BasePart, ElevatorDoor1: BasePart, Eleva
}, Doors)
end
local function DoorsAnimation(self, opening: boolean?, stopping: boolean?)
local function DoorsAnimation(self, opening: boolean?)
local ElevatorDoor1_P = self.ElevatorDoor1.Position
local ElevatorDoor2_P = self.ElevatorDoor2.Position
local Door1Stopped_X = stopping and Vector3.xAxis*ElevatorDoor1_P.X-Vector3.xAxis*2.9 or Vector3.xAxis*2.9
local Door2Stopped_X = stopping and Vector3.xAxis*ElevatorDoor2_P.X-Vector3.xAxis*6 or Vector3.xAxis*6
local TweenTime = opening and 3.5 or 5
local Door1Tween = self.DoorTween1:Start(nil, {
Position = opening and ElevatorDoor1_P+Door1Stopped_X or ElevatorDoor1_P-Door1Stopped_X
Position = opening and ElevatorDoor1_P+Vector3.xAxis*math.max((ElevatorDoor1_P-Door1Stopped_X).X, Door1Stopped_X.X) or ElevatorDoor1_P-Door1Stopped_X
}, TweenInfo.new(
opening and 3.5 or 5,
TweenTime,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut
))
local Door2Tween = self.DoorTween2:Start(nil, {
Position = opening and ElevatorDoor2_P+Door2Stopped_X or ElevatorDoor2_P-Door2Stopped_X
Position = opening and ElevatorDoor2_P+Vector3.xAxis*math.max((ElevatorDoor2_P-Door2Stopped_X).X, Door2Stopped_X.X) or ElevatorDoor2_P-Door1Stopped_X
}, TweenInfo.new(
opening and 3.5 or 5,
TweenTime,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut
))
@@ -52,7 +55,7 @@ local function DoorsAnimation(self, opening: boolean?, stopping: boolean?)
if Doors.DontLeakMemory then
Doors.DontLeakMemory:Disconnect()
end
Doors.DontLeakMemory = self:__Sensor(Door1Tween, Door2Tween)
Doors.DontLeakMemory = self:DetectSensorHit(Door1Tween, Door2Tween)
return Door1Tween, Door2Tween
end
@@ -70,7 +73,7 @@ for n: number = 1, #workspace_items do
end
end
function Doors:__Sensor(DoorTween1, DoorTween2): nil | RBXScriptSignal
function Doors:DetectSensorHit(DoorTween1, DoorTween2): nil | RBXScriptSignal
local Step = nil
if Doors.Closed then
raycastParams.FilterDescendantsInstances = {self.ElevatorBox, table.unpack(RayIgnoring)}
@@ -82,8 +85,8 @@ function Doors:__Sensor(DoorTween1, DoorTween2): nil | RBXScriptSignal
print("Hit=",DoorSensor.Instance:GetFullName())
DoorTween1:Pause()
DoorTween2:Pause()
task.wait(1) --elevator at work has this delay
DoorsAnimation(self, true, true)
task.wait(1) --elevator at my work has this similar delay lol
DoorsAnimation(self, true)
-- DoorTween1:Destroy()
-- DoorTween2:Destroy()
end

View File

@@ -35,6 +35,8 @@ end
--"it will solve the issue of exploiters messing with the elevator"
ElevatorBox_1960:SetNetworkOwner(nil)
print(Tags)
task.wait(2)
ElevatorDoors:Opening(true)
task.wait(2)

View File

View File

@@ -6,7 +6,8 @@ local AllTags = CS:GetAllTags()
for i = 1, #AllTags do
local TagName = AllTags[i]
if TagName ~= "RopeMasterObject" then
exports[TagName] = CS:GetTagged(TagName)[1]
local Tagged = CS:GetTagged(TagName)
exports[TagName] = #Tagged>1 and Tagged or Tagged[1]
end
end