Skip to content

Commit

Permalink
Added :removecam and fixed :makecam making a camera called "nil" if n…
Browse files Browse the repository at this point in the history
…o name was provided (Epix-Incorporated#1457)
  • Loading branch information
WalkerOfBacon authored Mar 20, 2024
1 parent a36293e commit 77d2d16
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions MainModule/Server/Commands/Moderators.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,8 @@ return function(Vargs, env)
Function = function(plr: Player, args: {string})
local head = plr.Character and (plr.Character:FindFirstChild("Head") or plr.Character:FindFirstChild("HumanoidRootPart"))
assert(head and head:IsA("BasePart"), "You don't have a character head or root part")
if not args[1] then return Functions.Hint("A name is required!", {plr}) end

if workspace:FindFirstChild(`Camera: {args[1]}`) then
Functions.Hint(`{args[1]} Already Exists!`, {plr})
else
Expand All @@ -1481,6 +1483,30 @@ return function(Vargs, env)
MeshType = "Sphere";
})
table.insert(Variables.Cameras, {Brick = cam, Name = args[1]})
Functions.Hint(`Created camera {args[1]}`, {plr})
end
end
};

RemoveCamera = {
Prefix = Settings.Prefix;
Commands = {"removecam", "delcam", "removecamera", "deletecamera"};
Args = {"camera"};
Description = "Deletes the camera if it exists";
AdminLevel = "Moderators";
Function = function(plr: Player, args: {string})
for i,v in Variables.Cameras do
if string.lower(args[1]) == v.Name then
local cam = workspace:FindFirstChild(v)

Variables.Cameras[i] = nil

if cam and cam:IsA("Part") then
cam:Destroy()
end

Functions.Hint(`Deleted camera {v.Name}`, {plr})
end
end
end
};
Expand Down

0 comments on commit 77d2d16

Please sign in to comment.