Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make a custom trail that is a admin only?

So here is the script tryed to make it where I want ONLY a person that can have it.

local isAdmin = {["dog6779"] = true, ["DutchCoder"] = true} -- to add more players just do this for example local isAdmin = {["NAME"] = true} make sure to add the , at the end then space and do the same

game.Players.PlayerAdded:connect(function(player)
	if isAdmin[player.Name] then
while true do
game.Players.PlayerAdded:Connect(function(player)
          player.CharacterAdded:Connect(function(char)
                  local trail = game.ServerStorage.Trail:Clone()
                  trail.Parent = char.Head
                  local attachment0 = Instance.new("Attachment",char.Head)
                  attachment0.Name = "TrailAttachment0"
                  local attachment1 = Instance.new("Attachment",char.HumanoidRootPart)
                  attachment1.Name = "TrailAttachment1"
                  trail.Attachment0 = attachment0
                  trail.Attachment1 = attachment1
           end)
end)

So how can I make it where it's just the person?

And here the photo's what I am doing.

https://gyazo.com/2f0b9a6463d43b58928df929a0511755

2 comments

0

remove line 5 and 6.

0

Nevermind, I take that back it worked!

1 answer

✓ Accepted answer

Instead of using that, I would just loop through the table and check if it contains the player who joined.

local admins = {"dog6779", "DutchCoder"}

game.Players.PlayerAdded:connect(function(player)
    if isAdmin(player.Name) then
		while true do
			game.Players.PlayerAdded:Connect(function(player)
				player.CharacterAdded:Connect(function(char)
			    	local trail = game.ServerStorage.Trail:Clone()
			        trail.Parent = char.Head
			        local attachment0 = Instance.new("Attachment",char.Head)
			        attachment0.Name = "TrailAttachment0"
			        local attachment1 = Instance.new("Attachment",char.HumanoidRootPart)
			        attachment1.Name = "TrailAttachment1"
			        trail.Attachment0 = attachment0
			        trail.Attachment1 = attachment1
				end)
			end)
		end
	end
end)

function isAdmin(username)
	for i,v in pairs(admins) do
		if v == username then
			return true
		end
	end
	return false
end

1 comment

0

Okay, the script work. but the trail does not seem to show up?

This discussion is preserved as it was. New answers, comments, and votes are closed.