I recently created a trap command that works as intended, however, I encountered difficulty when trying to make the untrap command. This is what the command currently looks like:
if args[1] == prefix.."trap" then
if args[2] == "me" then
if AllowCommandsToBeReplicated == true then
local Clone = script.Parent.Models.TrapBase.Union:Clone()
Clone.Parent = workspace
Clone.CFrame = plr.Character.HumanoidRootPart.CFrame
Clone.Name = plr.Name
else
if game.Workspace:FindFirstChild('TrapFor_'..plr.Name) then
return
else
local Clone = script.Parent.Models.TrapBase.Union:Clone()
Clone.Parent = workspace
Clone.CFrame = plr.Character.HumanoidRootPart.CFrame
Clone.Name = plr.Name
end
end
-- More Code But not needed to be shown.
When attempting to make the untrap command, I initially considered checking the Workspace for the player’s name, but since players are typically located in the Workspace, I thought I could check if the object’s name is the player’s name and if the classname is a UnionOperator. Can anyone suggest an improved approach?
The trap command that works:
i know its not the best way to go with but in the time being i thought
it could do the job, and it does so yea.
Only thing im really strugiling with is the untrap command.