I am trying to make it to where it will save a hat
If it were bought in a in-game store.
game.Players.PlayerAdded:connect(function(plr)
plr:WaitForDataReady()
plr.CharacterAdded:connect(function(usr)
local stats = Instance.new("IntValue")
stats.Name = "dist"
local hat = Instance.new("BoolValue")
hat.Name = "Dominus"
hat.Value = false
hat.Parent = stats
stats.Parent = plr
if plr:LoadBoolean("A") then
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "HoodedAssassin"
p.Parent = h
p.Position = usr:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(1, 0.4, 1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
mesh = Instance.new("SpecialMesh", p)
mesh.MeshId = "http://www.roblox.com/asset/?id=21057410"
h.Parent = usr
h.AttachmentForward = Vector3.new (-0, -0, -1)
h.AttachmentPos = Vector3.new(0, 0.4, 0)
h.AttachmentRight = Vector3.new (1, 0, 0)
h.AttachmentUp = Vector3.new (0, 1, 0)
else
print("Player does not own this hat.")
end
end)
end)
game.Players.PlayerRemoving:connect(function(plyr)
plyr:SaveBoolean("A", plyr.leaderstats.hat.Value)
end)
