game.ReplicatedStorage.Transfromgold.Trans.OnServerEvent:Connect(function(plr) local unfrom = false local chr = plr.Character local ref = game.Workspace.Part local hum = chr:WaitForChild("Humanoid") local InputService = game:GetService("UserInputService") for _,body in pairs(chr:GetChildren()) do if body:IsA("BasePart") then body.BrickColor = BrickColor.new("Gold") body.Material = "Neon" end for _,size in pairs(hum:GetChildren())do if size:IsA("NumberValue") then size.Value = 5 end local shirt = chr:WaitForChild("Shirt") shirt:Destroy() -- "BodyDepthScale" or "BodyWidthScale" or "HeadScale" then --resize.Value = 7 hum:WaitForChild("BodyDepthScale").Value = 10 hum:WaitForChild("BodyWidthScale").Value = 7.89 hum:WaitForChild("HeadScale").Value = 6 hum.WalkSpeed = 41 hum.JumpPower = 77 unfrom = true end end end)
You need to check if there is a shirt in the first place. Otherwise, you may receive the error "Infinite yield possible on ____". You should use a conditional statement and :FindFirstChild()
for this. You can use something like the following to do so:
if chr:FindFirstChild("Shirt") then chr.Shirt:Destroy() end