I'm working on a game and I made a morph when you click a gui button.
Here is the script:
local Suit = game.Lighting:findFirstChild(script.Parent.Suit.Value) -- finds the suits
local Me = script.Parent.Parent.Parent.Parent.Parent.Character -- finds you
local Weapon = game.Lighting:findFirstChild(script.Parent.Weapon.Value) -- Give You A Weapon
local Weapon1 = game.Lighting:findFirstChild(script.Parent.Weapon1.Value) -- Give You A Weapon
local Weapon2 = game.Lighting:findFirstChild(script.Parent.Weapon2.Value) -- Give You A Weapon
local Weapon3 = game.Lighting:findFirstChild(script.Parent.Weapon3.Value) -- Give You A Weapon
local debounce = false
local Me2 = script.Parent.Parent.Parent.Parent.Parent.Backpack -- this puts the weapon into backpack
local Me3 = script.Parent.Parent.Parent.Parent.Parent.PlayerGui -- this puts the weapon into backpack
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 Click2(mouse)
-- Speed, Weapons, and Health Give in this Function
local human = Me:findFirstChild("Humanoid")
if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
--[[Weapon:clone().Parent = Me2 -- this makes when you click this GUI it weilds on you
Weapon1:clone().Parent = Me2 -- these weapons go into your backpack (not auto weld like above)
Weapon2:clone().Parent = Me2
Weapon3:clone().Parent = Me3
]]--
wait(1)
debounce = false
script.Parent.Parent.Visible = false
human.WalkSpeed = script.Parent.Speed.Value -- changes your WalkSpeed to the "Speed" Value
human.MaxHealth = script.Parent.Health.Value -- changes your MaxHealth to the "Health" Value
human.Health = script.Parent.Health.Value
local hat = Suit.BrownRoblohunk:Clone()
hat.Parent = Me
local hat2 = Suit.SteampunkCadetHat:Clone()
hat2.Parent = Me
Me.Head.face:remove()
local newface = Suit.face:Clone()
newface.Parent = Me.Head
Me.Shirt:remove()
Me.Pants:remove()
local Shirt = Suit.Shirt:Clone()
local Pants = Suit.Pants:Clone()
Shirt.Parent = Me
Pants.Parent = Me-- changes your MaxHealth to the "Health" Value
end
end
script.Parent.MouseButton1Down:connect(Click2)
and here is the error:
(line 48) attempt to index upvalue 'Suit' (a nil value)
Help needed ASAP. Thank you!
