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

Why is this Hat Giver For Creators Only Script not working?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I did make this script but as i tryed testing it it didnt gave me the hat what did i do wrong?

This Script Schould give the Creator an hat

if Creators("LordDamionDevil","Juide") then

local hat = 180516502
 game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        asset = game:GetService("InsertService"):LoadAsset(hat)
        give = game:GetService("InsertService"):Insert(asset)
        local children = asset:GetChildren()
        for i = 1, #children do
            children[i].Parent = character
        end
    end)
end)

2
Is Creators() a function somewhere else in the script? Spongocardo 1991 — 10y
0
No LordDamionDevil 0 — 10y
0
But i try to make it for Creators only LordDamionDevil 0 — 10y
0
should isnt spelt like schould NinjoOnline 1146 — 10y
0
plus you cant have creators in that way in an if statement NinjoOnline 1146 — 10y

1 answer

Log in to vote
3
Answered by
RedCombee 585 Moderation Voter
10 years ago

You're missing a couple things. First, there is no 'end' for your if statement in the first line of code. Second, 'Creators' does not appear to be a function, and the if statement is unnecessary anyway.

local Creators = {"LordDamionDevil","Juide"} -- This is a table which will help us later on in the script.
local hat = 180516502

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        for i,v in pairs(Creators) do -- This is a convenient method of going through the list of Creators to see if the player's name is in there.
            if v == player.Name then
                    asset = game:GetService("InsertService"):LoadAsset(hat)
                    give = game:GetService("InsertService"):Insert(asset)
                    local children = asset:GetChildren()
                for i,v in pairs(children) do
                    if v:IsA("Hat") then
                    v.Parent = player
                end
            end
        end
    end)
end)
0
Thanks for the help :) LordDamionDevil 0 — 10y
Ad

Answer this question