Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
dog6779 25
6 years ago
Edited 6 years ago

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

0
remove line 5 and 6. RubenKan 3615 — 6y
0
Nevermind, I take that back it worked! dog6779 25 — 6y

1 answer

Log in to vote
0
Answered by
xAtom_ik 574 Moderation Voter
6 years ago

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
0
Okay, the script work. but the trail does not seem to show up? dog6779 25 — 6y
Ad

Answer this question