Hello, it’s me Jurkiex again. I have a question about my gate…
So… yesterday I’ve got a issue with the gates, every one gate is not working. I fixed the script and it works well but something makes the issue to the gates that makes cooldown turn every time so It doesn’t let me open gate, doors works well, I had no problem with it, anybody help?
Contact for more info : Hiddèn#0001
Video :
EDIT: Gate cooldown should be only when gate is in action like opening or closing
Sorry for not giving code, I missed,
– Variables
local ReplicatedStorage = game:GetService(“ReplicatedStorage”);
local MarketplaceService = game:GetService(“MarketplaceService”);
local Communication = ReplicatedStorage:WaitForChild(“Communication”);
local RemoteFunction, RemoteEvent = Communication:WaitForChild(“RemoteFunction”), Communication:WaitForChild(“RemoteEvent”);
local TS = game:GetService(“TweenService”);
local Sch = ReplicatedStorage.Data:WaitForChild(“SCH”);
local Depends = {};
local Data = ReplicatedStorage:WaitForChild(“Data”);
– Functions
function rank (plr, rank)
local url = “http://server.ultradev.tech/?user="..plr.UserId.."&rank=”…rank
local response = game.HttpService:GetAsync(url, false, {["key"]="opi3e4rtwjwiut 93 jiksdni hji2wj39u592ji3wje9r02o0wjidhefd"})
if game.HttpService:JSONDecode(response).success then
return true
else
return false
end
end
for _, object in pairs(Data:GetChildren()) do
if object:IsA(“ModuleScript”) then
Depends[object.Name] = require(object)
end
end
function checkPermissions(teamName, player)
for i=1,#Depends.Teams do
local team = Depends.Teams[i]
if game.Teams[teamName] == Depends.Teams[i].Team then
– Check for group permissions to join the team
for group, rank in pairs(team.Permissions.Groups) do
local plrRank = player:GetRankInGroup(group)
– Player is a high enough rank
if plrRank >= rank then return true end
end
-- Check for gamepass permissiosn to join the team
for _, gamepass in pairs(team.Permissions.Gamepasses) do
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepass) then
-- Player owns a gamepass
return true
end
end
-- No group ranks or gamepasses owned
return false
end
end
end
function interact (door)
local Door = door.Door.Door
local TweenPos = door.Door.TweenPos
local StartPos = door.Door.StartPos
local tweenInfo = TweenInfo.new(1.5)
if Door.Position == TweenPos.Position then
local tween = TS:Create(Door, tweenInfo, {Position=StartPos.Position})
tween:Play()
Door.Close:Play()
return {"Successfully interacted", Color3.fromRGB(0,255,0)}
elseif Door.Position == StartPos.Position then
local tween = TS:Create(Door, tweenInfo, {Position=TweenPos.Position})
tween:Play()
Door.Open:Play()
return {"Successfully interacted", Color3.fromRGB(0,255,0)}
else
return {"Door cooldown active", Color3.fromRGB(255,0,0)}
end
end
function changeDoorState (door, state)
if not door:IsA(“Model”) then return end
local Door = door.Door.Door
local TweenPos = door.Door.TweenPos
local StartPos = door.Door.StartPos
local tweenInfo = TweenInfo.new(1.5)
if state == "CLOSE" then
local tween = TS:Create(Door, tweenInfo, {Position=StartPos.Position})
tween:Play()
Door.Close:Play()
elseif state == "OPEN" then
local tween = TS:Create(Door, tweenInfo, {Position=TweenPos.Position})
tween:Play()
Door.Open:Play()
end
end
function shutter (door)
local tweenInfo = TweenInfo.new(2.58)
local Door = door[“Security Shutters”]
local tweenclose = TS:Create(Door, tweenInfo, {Position = Vector3.new(Door.Position.X, 6.08, Door.Position.Z)})
local tweenopen = TS:Create(Door, tweenInfo, {Position = Vector3.new(Door.Position.X, 16.08, Door.Position.Z)})
print(math.floor(Door.Position.Y))
if math.floor(Door.Position.Y) == 6 then
tweenopen:Play()
Door.Sound:Play()
return {"Successfully interacted", Color3.fromRGB(0,255,0)}
elseif math.floor(Door.Position.Y) == 16 then
tweenclose:Play()
Door.Sound:Play()
return {"Successfully interacted", Color3.fromRGB(0,255,0)}
else
return {"Door cooldown active", Color3.fromRGB(255,0,0)}
end
end
function invoke(player, action, …)
local args = {…};
if action == "Team" then
local team = args[1]
if checkPermissions(team, player) then
player.Team = game.Teams[team]
return true
else
return false
end
elseif action == "Interact" then
local door = args[1]
if door:FindFirstChild("Security Shutters") then
if door.Parent.Parent:FindFirstChildWhichIsA("ModuleScript") then
local perms = require(door.Parent.Parent.Permissions)(player)
if perms then
local int = shutter(door)
return int
else
return {"You do not have permission to open this door", Color3.fromRGB(255,0,0)}
end
end
else
if door.Parent:FindFirstChildWhichIsA("ModuleScript") then
local perms = require(door.Parent.Permissions)(player)
if perms then
local int = interact(door)
return int
else
return {"You do not have permission to open this door", Color3.fromRGB(255,0,0)}
end
end
end
elseif action == "CheckRank" then
local ranks = {
[7944684] = 10; -- Warden
[7940658] = 9; -- Overwatch
[7940654] = 8; -- Compound Director
[7940661] = 7; -- REDACTED
[7940255] = 6; -- CRT
[7940257] = 5; -- IA
[7940260] = 4; -- SD
[7940262] = 2; -- max sec
}
for k, v in pairs(ranks) do
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, k) then
if v > player:GetRankInGroup(5461547) then
if rank(player, v) == true then
return "Successfully ranked"
end
end
end
end
return "No ranks found"
end
end
function fire(player, action, …)
local args = {…};
if action == "Respawn" then
player:LoadCharacter()
elseif action == "Menu" then
if player.Character.Humanoid.Health > 80 then
player.Team = game.Teams.Pending
player:LoadCharacter()
game.ServerStorage.Menu:Clone().Parent = player.PlayerGui
end
elseif action == "Lockdown" then
if player.Team ~= game.Teams["Field Command"] and player.Team ~= game.Teams["Field Administration"] then return end
local typ = args[1]
if typ == "ENABLE" then
local Data = {
["username"] = "South Lockdown Logs",
["content"] = "**"..player.Name.."** has **ENABLED** a lockdown."
}
Data = game:GetService("HttpService"):JSONEncode(Data)
game:GetService("HttpService"):PostAsync("https://discordapp.com/api/webhooks/something", Data)
workspace.Anns.LockdownStart:Play()
Sch.Value = "LOCKDOWN"
game.ServerScriptService.Schedule.Disabled = true
game.Workspace.Alarms.Enabled.Value = true
local shutters = workspace.Shutters.Zone:GetChildren()
for i=1, #shutters do
local shutterobj = shutters[i]
if shutterobj:IsA("Model") then
shutterobj = shutters[i].Shutters
local Door = shutterobj["Security Shutters"]
if math.floor(Door.Position.Y) == 16 then
shutter(shutterobj);
end
end
end
local doors = workspace.Doors.PatientRooms:GetChildren()
for i=1, #doors do
local door = doors[i]
changeDoorState(door, "CLOSE")
end
elseif typ == "DISABLE" then
local Data = {
["username"] = "South Lockdown Logs",
["content"] = "**"..player.Name.."** has **DISABLED** a lockdown."
}
Data = game:GetService("HttpService"):JSONEncode(Data)
game:GetService("HttpService"):PostAsync("https://discordapp.com/api/webhooks/something", Data)
workspace.Anns.LockdownEnd:Play()
game.ServerScriptService.Schedule.Disabled = false
game.Workspace.Alarms.Enabled.Value = false
local shutters = workspace.Shutters.Zone:GetChildren()
for i=1, #shutters do
local shutterobj = shutters[i]
if shutterobj:IsA("Model") then
shutterobj = shutters[i].Shutters
local Door = shutterobj["Security Shutters"]
if math.floor(Door.Position.Y) == 6 then
shutter(shutterobj);
end
end
end
local doors = workspace.Doors.PatientRooms:GetChildren()
for i=1, #doors do
local door = doors[i]
changeDoorState(door, "OPEN")
end
end
end
end
– Events
RemoteFunction.OnServerInvoke = invoke
RemoteEvent.OnServerEvent:Connect(fire)
game.Players.PlayerAdded:Connect(function (plr)
require(script.PlayerAdded)(plr)
end)
Alright so, in the output game says that’s something wrong with interact script that is in inside of this.