Basic Admin Custom Plugin Track command

Hey developers! I was wondering how I could get the player executing the command in this since I want to parent an attachment of the beam to the targetted player and the player executing the command.

This is the “essential code” local script under the Basic Admin model by the way.

Also, it would be helpful if I can get help knowing how to make an “Untrack” command (somehow remove the beams between the targetted player and the executor as well based on this code.

local function Track()
	
	local cmdlp = game:GetService("Players").LocalPlayer


	local HRP = cmdlp.Character:FindFirstChild("HumanoidRootPart") -- HumanoidRootPart

	local Humanoid = cmdlp.Character:FindFirstChild("Humanoid") -- Humanoid


	local Highlight = Instance.new("Highlight")
	Highlight.FillColor = Color3.fromRGB(46, 119, 255)
	Highlight.OutlineColor = Color3.fromRGB(46, 119, 255)
	Highlight.OutlineTransparency = 0
	Highlight.FillTransparency = 0.6
	
	local NewNametag = game:GetService("ReplicatedStorage"):FindFirstChild("NameTagTrack"):Clone()
	NewNametag.Name = cmdlp.Name.."Name Tracker"
	NewNametag.TextLabel.Text = cmdlp.Name
	
	local Attachment1 = Instance.new("Attachment")
	Attachment1.Name = "TrackerBeamAttach1"
	Attachment1.Parent = HRP
	local Attachment2 = Instance.new("Attachment")
	Attachment2.Name = "TrackerBeamAttach2"
	Attachment2.Parent =  --player's executing the command rootpart
	
	local NewBeam = game:GetService("ReplicatedStorage"):FindFirstChild("BeamTrack"):Clone()
	NewBeam.Name = cmdlp.Name.."Beam Tracker"
	NewBeam.Enabled = false
	
	NewNametag.Parent = cmdlp.Character.Head
	NewNametag.Adornee = cmdlp.Character.Head
	Highlight.Parent = cmdlp.Character
	Highlight.Adornee = cmdlp.Character
	NewBeam.Attachment0 = Attachment1
	NewBeam.Attachment1 = Attachment2
	NewBeam.Enabled = true
end

Thank you for the help!

Hey, if you still need help feel free to dm me on discord: bodieblox

1 Like