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

Getting a hat from the server storage?

local p = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent
local c = p.Character
script.Parent.MouseButton1Up:connect(function()
if p.leaderstats.Lvl.Value >= 1 then
local d = c:GetChildren()
for i=1, #d do
if d[i].className == "Hat" then
d[i]:remove()
end
end
print 'Hats Removed'
wait()
local ha = Instance.new("Hat")
ha.AttachmentForward= Vector3.new(-0, -0, -1)
ha.AttachmentPos = Vector3.new(0, 1.64, -0.01)
ha.AttachmentRight = Vector3.new(1, 0, 0)
ha.AttachmentUp = Vector3.new(0, 1, 0)
a=ServerStorage.DemondHood ---- The Issue 
b = a:GetChildren()
for i=1, #b do
b[i].Parent = h
end
h.Parent = c
end
end)
print 'Hat Added'

line 18 used to be "a=game:GetService("InsertService"):LoadAsset(166900742)" but it loaded too slow. Im trying to get it to get the hat from server storage. Theres a model insde server storage, called DemonHood, and inside there is the part with the mesh

1 answer

local p = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent
local c = p.Character
script.Parent.MouseButton1Up:connect(function()
if p.leaderstats.Lvl.Value >= 1 then
local d = c:GetChildren()
for i=1, #d do
if d[i].className == "Hat" then
d[i]:remove()
end
end
print 'Hats Removed'
wait()
local ha = Instance.new("Hat")
ha.AttachmentForward= Vector3.new(-0, -0, -1)
ha.AttachmentPos = Vector3.new(0, 1.64, -0.01)
ha.AttachmentRight = Vector3.new(1, 0, 0)
ha.AttachmentUp = Vector3.new(0, 1, 0)
a=game.ServerStorage["Demond Hood"] ---- The Issue 
b = a:GetChildren()
for i=1, #b do
b[i].Parent = h
end
h.Parent = c
end
end)
print 'Hat Added'

There you go! Try that! Happy scripting :)

4 comments

0

"DemonHood is not a valid member of ServerStorage"

0

Try this script

0

Still get the same error

0

Then DemonHood is not in ServerStorage or it is in something in ServerStorage.

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