So, basically the script is to morph the player into Sasuke (anime character) and it already works. But I want to make it only works when the player has a Shirt named "shirt". That's the script
local Tool = script.Parent; local SasukeClassicShirt = game.ReplicatedStorage.Clothes.SasukeClassicShirt:Clone() local SasukeClassicPants = game.ReplicatedStorage.Clothes.SasukeClassicPants:Clone() local SasukeClassicFace = game.ReplicatedStorage.SasukeClassicFace:Clone() Tool.Equipped:Connect(function() player = script.Parent.Parent player.Humanoid.MaxHealth = player.Humanoid.MaxHealth + 9999999 player.Humanoid.Health = player.Humanoid.MaxHealth player.Shirt:remove() SasukeClassicShirt.Parent = player player.Pants:remove() SasukeClassicPants.Parent = player player.Head.face:remove() SasukeClassicFace.Parent = player.Head local SSJHair = game.ReplicatedStorage.SSJHair:Clone() SSJHair.Parent = player SSJHair.CFrame = player.Torso.CFrame local Weld = Instance.new("Weld") Weld.Name = "SSJ" Weld.Parent = player.Head Weld.Part0 = player.Head Weld.Part1 = SSJHair Weld.C0 = CFrame.new(0.05, 0.5, 0.4) * CFrame.Angles(0,math.pi,0) Weld.C1 = CFrame.fromOrientation(0, -179.2, 0) Tool:remove() end)
All you need to do is add a simple conditional statement after your Equipped
event. Also, note that :remove()
is deprecated. Use :Destroy()
instead.
local Tool = script.Parent; local SasukeClassicShirt = game.ReplicatedStorage.Clothes.SasukeClassicShirt:Clone() local SasukeClassicPants = game.ReplicatedStorage.Clothes.SasukeClassicPants:Clone() local SasukeClassicFace = game.ReplicatedStorage.SasukeClassicFace:Clone() Tool.Equipped:Connect(function() player = script.Parent.Parent if player:FindFirstChild("shirt") then player.Humanoid.MaxHealth = player.Humanoid.MaxHealth + 9999999 player.Humanoid.Health = player.Humanoid.MaxHealth player.Shirt:Destroy() SasukeClassicShirt.Parent = player player.Pants:remove() SasukeClassicPants.Parent = player player.Head.face:remove() SasukeClassicFace.Parent = player.Head local SSJHair = game.ReplicatedStorage.SSJHair:Clone() SSJHair.Parent = player SSJHair.CFrame = player.Torso.CFrame local Weld = Instance.new("Weld") Weld.Name = "SSJ" Weld.Parent = player.Head Weld.Part0 = player.Head Weld.Part1 = SSJHair Weld.C0 = CFrame.new(0.05, 0.5, 0.4) * CFrame.Angles(0,math.pi,0) Weld.C1 = CFrame.fromOrientation(0, -179.2, 0) Tool:Destroy() end end)