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

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

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)

5 comments

2

Is Creators() a function somewhere else in the script?

0

No

0

But i try to make it for Creators only

0

should isnt spelt like schould

0

plus you cant have creators in that way in an if statement

1 answer

✓ Accepted answer

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)

1 comment

0

Thanks for the help :)

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