it doesnt give the armor
local cln = script.Parent.Shirt:clone()
local cln2 = script.Parent.Pants:clone()
local debounce = false
function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid")
if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
user = game.Players:findFirstChild(human.Parent.Name)
local gold = user.leaderstats.Lvl
if (gold.Value >= 20) then
--gold.Value = gold.Value - 20
m = Instance.new("Hint")
m.Text = "You Have gold armor (300 Health)!"
m.Parent = player
local s = part.Parent:findFirstChild("Shirt")
local d = part.Parent.Torso:findFirstChild("roblox")
local p = part.Parent:findFirstChild("Pants")
if s~=nil and d~=nil and p~=nil then
part.Parent.Torso.roblox:remove()
part.Parent.Shirt:remove()
part.Parent.Pants:remove()
cln2.Parent = part.Parent
cln.Parent = part.Parent
elseif s~=nil then
part.Parent.Shirt:remove()
cln.Parent = part.Parent
elseif p~=nil then
part.Parent.Pants:remove()
cln2.Parent = part.Parent
elseif d~=nil then
part.Parent.Torso.roblox:remove()
cln.Parent = part.Parent
elseif s==nil and d==nil and p==nil then
cln.Parent = part.Parent
cln2.Parent = part.Parent
end
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "HopliteHelm"
p.Parent = h
p.Position = part.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(2, 1, 1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Parent.Mesh:clone().Parent = p
h.Parent = part.Parent
h.AttachmentPos = Vector3.new(0, .2, -.2)
--h = Instance.new("Hat")
--f = script.Parent.Parent.Coif:clone()
--h.Name = "HopliteHelm"
--f.Parent = h
--f.Position = part.Parent:findFirstChild("Head").Position
--f.Name = "Handle"
--f.Anchored = false
--f.Locked = true
--f.CanCollide = false
--h.Parent = part.Parent
--h.AttachmentPos = Vector3.new(0, -.8, 0)
human.MaxHealth = 300
wait()
human.Health = human.MaxHealth
wait(2)
m.Parent = nil
else
m = Instance.new("Hint")
m.Text = "you dont have high enough level!"
m.Parent = player
wait(3)
m.Parent = nil
end
wait(2)
debounce = false
end
end
script.Parent.Touched:connect(onTouch)
|