I've got two scripts that change the scale of the players size. The 1st script changes it to 2, and the 2nd script changes it to 4. Sometimes they will kill the player when they get bigger or smaller. Any idea why?
1st script:
local Player = game.Players.LocalPlayer local mouse = Player:GetMouse() local lastUse = 0; local God = Player:waitForChild("Stats").MinorGod local lightning = game.ReplicatedStorage.MinorTransform.Lightning local char = Player.Character or Player.CharacterAdded:Wait() local hum = char:WaitForChild("Humanoid") Player.CharacterAdded:connect(function(character) char = character hum = char:WaitForChild("Humanoid") end) if not hum.Parent then repeat wait(0.2) until hum.Parent end -- HeadScale = 1.8, everything else = 2 local function GodMode(key) local Key = key:lower() if key == "r" and Player.NonSave.GodOn.Value == false and tick()-lastUse > 5 and Player.Character.Humanoid.Health == 100 and God.Value == 1 then lastUse = tick(); Player.NonSave.GodOn.Value = true Player.Character.Humanoid.WalkSpeed = 0 local animTrack = hum:LoadAnimation(script.Pose) animTrack:Play() --clone effects local a = lightning:Clone() a.Parent = Player.Character.UpperTorso local b = lightning:Clone() b.Parent = Player.Character.LeftLowerArm local c = lightning:Clone() c.Parent = Player.Character.LeftUpperArm local d = lightning:Clone() d.Parent = Player.Character.RightUpperArm local e = lightning:Clone() e.Parent = Player.Character.RightLowerArm local f = lightning:Clone() f.Parent = Player.Character.LeftLowerLeg local g = lightning:Clone() g.Parent = Player.Character.LeftUpperLeg local m = lightning:Clone() m.Parent = Player.Character.LeftFoot local o = lightning:Clone() o.Parent = Player.Character.RightLowerLeg local h = lightning:Clone() h.Parent = Player.Character.RightUpperLeg local i = lightning:Clone() i.Parent = Player.Character.RightFoot local yellow = game.ReplicatedStorage.MinorTransform.Yellow:Clone() yellow.Parent = Player.Character.UpperTorso wait(2) --create part -- Player.Character.Humanoid.MaxHealth = 150 wait(1) -- Player.Character.Humanoid.Health = 150 local explode = Instance.new("Part") explode.BrickColor = BrickColor.new ("Bright violet") explode.Material = "Neon" explode.Anchored = true explode.CanCollide = false explode.TopSurface = "Smooth" explode.BottomSurface = "Smooth" explode.Size = Vector3.new(5,5,5) explode.Parent = game.workspace explode.CFrame = Player.Character.UpperTorso.CFrame local me = Instance.new("SpecialMesh") me.MeshType = "Sphere" me.Scale = Vector3.new(2,2,2) me.Parent = explode local fix = game.ReplicatedStorage.EmergencySkillRemove:Clone() fix.Parent = explode local sound = Instance.new("Sound") sound.SoundId = "http://www.roblox.com/asset/?id=506383970" sound.Parent = Player.Character.UpperTorso sound.Volume = 4 sound:Play() --set size Player.Character.Humanoid.BodyDepthScale.Value = 2 Player.Character.Humanoid.BodyHeightScale.Value = 2 Player.Character.Humanoid.BodyWidthScale.Value = 2 Player.Character.Humanoid.HeadScale.Value = 1.8 --explode for expand = 1,50 do me.Scale = me.Scale + Vector3.new(0.2,0.2,0.2) explode.Transparency = explode.Transparency + 0.02 wait(0.0001) end local sound = Instance.new("Sound") sound.SoundId = "http://www.roblox.com/asset/?id=130818250" sound.Parent = explode sound.Volume = 4 sound:Play() wait(4) animTrack:Stop() Player.Character.Humanoid.WalkSpeed = 16 --remove effects game.Debris:AddItem(a,0.1) game.Debris:AddItem(b,0.1) game.Debris:AddItem(c,0.1) game.Debris:AddItem(d,0.1) game.Debris:AddItem(e,0.1) game.Debris:AddItem(f,0.1) game.Debris:AddItem(g,0.1) game.Debris:AddItem(h,0.1) game.Debris:AddItem(i,0.1) game.Debris:AddItem(o,0.1) game.Debris:AddItem(m,0.1) game.Debris:AddItem(yellow,0.1) game.Debris:AddItem(explode,2) game.Debris:AddItem(me,2) end end local function GodModeOff(key) local Key = key:lower() if key == "r" and Player.NonSave.GodOn.Value == true and tick()-lastUse > 5 and God.Value == 1 then lastUse = tick(); Player.Character.Humanoid.WalkSpeed = 0 local animTrack = hum:LoadAnimation(script.PoseOff) animTrack:Play() local Down = Instance.new("Part") Down.BrickColor = BrickColor.new ("Bright violet") Down.Material = "Neon" Down.Anchored = true Down.CanCollide = false Down.TopSurface = "Smooth" Down.BottomSurface = "Smooth" Down.Size = Vector3.new(10,10,10) Down.Transparency = 1 local fix2 = game.ReplicatedStorage.EmergencySkillRemove:Clone() fix2.Parent = Down Down.Parent = game.workspace Down.CFrame = Player.Character.UpperTorso.CFrame local em = Instance.new("SpecialMesh") em.MeshType = "Sphere" em.Scale = Vector3.new(8,8,8) em.Parent = Down for Shrink = 1,40 do em.Scale = em.Scale - Vector3.new(0.2,0.2,0.2) Down.Transparency = Down.Transparency - 0.02 wait(0.0001) end local sound2 = Instance.new("Sound") sound2.SoundId = "http://www.roblox.com/asset/?id=342472444" sound2.Parent = Player.Character.UpperTorso sound2.Volume = 4 sound2:Play() Player.NonSave.GodOn.Value = false wait(0.5) animTrack:Stop() Player.Character.Humanoid.WalkSpeed = 16 Player.Character.Humanoid.BodyDepthScale.Value = 1 Player.Character.Humanoid.BodyHeightScale.Value = 1 Player.Character.Humanoid.BodyWidthScale.Value = 1 Player.Character.Humanoid.HeadScale.Value = 1 game.Debris:AddItem(Down,3) -- Player.Character.Humanoid.MaxHealth = 100 end end mouse.KeyDown:connect(GodMode) mouse.KeyDown:connect(GodModeOff)
(2nd makes question too long, but it does the same thing except make the player size to 4 instead of 2.)