I recently made a transformation skill for one of my projects that I'm working on, when activated it plays sounds, inserts cool particle emitters into the player, and has some dialogue, as well as change walkspeed, health, and damage. The only problem is that when the damage is modified, it is suppose to be changed back to its original value when the transformation is turned off. It does go back to its original value when the transformation runs out of time, however the player can simply reset after they activate the skill and the damage will not return to its original value. I was wondering if I could counter this with an OnDied function, or maybe do something like
if Transform == true then plr.dmg.value = plr.dmg.value + number
You know? I'm not sure though. Here is the script, please tell me if there's anyway around this, and thanks for reading. This site has been really helpful lately, seriously, thank you ^^
bin=script.Parent me = script.Parent.Parent.Parent local thrust = Instance.new("BodyVelocity") enabled = true function onButton1Down(mouse) if enabled == false then return end torso = bin.Chest:clone() larm = bin.LArm:clone() rarm = bin.RArm:clone() lleg = bin.LLeg:clone() rleg = bin.RLeg:clone() horns = bin.Horns:clone() char = bin.Parent.Parent.Character enabled = false game:GetService("Chat"):Chat(me.Character.Head, "I can unlock my own hidden power....", Enum.ChatColor.Red) me.Character.Humanoid.WalkSpeed = 0 wait(1) if larm ~= nil then local larmweld = Instance.new("Weld") larmweld.Parent = larm larmweld.Part0 = larmweld.Parent larmweld.Part1 = char:findFirstChild("Left Arm") larmweld.C1 = CFrame.new(0, 0, 0) larm.Parent = char end wait(1) if rarm ~= nil then local rarmweld = Instance.new("Weld") rarmweld.Parent = rarm rarmweld.Part0 = rarmweld.Parent rarmweld.Part1 = char:findFirstChild("Right Arm") rarmweld.C1 = CFrame.new(0, 0, 0) rarm.Parent = char end game:GetService("Chat"):Chat(me.Character.Head, "I won't last long, but I need it!...", Enum.ChatColor.Red) wait(1) if rleg ~= nil then local rlegweld = Instance.new("Weld") rlegweld.Parent = rleg rlegweld.Part0 = rlegweld.Parent rlegweld.Part1 = char:findFirstChild("Right Leg") rlegweld.C1 = CFrame.new(0, 0, 0) rleg.Parent = char end wait(1) if lleg ~= nil then local llegweld = Instance.new("Weld") llegweld.Parent = lleg llegweld.Part0 = llegweld.Parent llegweld.Part1 = char:findFirstChild("Left Leg") llegweld.C1 = CFrame.new(0, 0, 0) lleg.Parent = char end wait(.5) if horns ~= nil then local hornsweld = Instance.new("Weld") hornsweld.Parent = horns hornsweld.Part0 = hornsweld.Parent hornsweld.Part1 = char.Head hornsweld.C1 = CFrame.new(0, 0, 0) horns.Parent = char end aa = Instance.new("Sound") aa.SoundId = "http://www.roblox.com/asset/?id=342472438" aa.Parent = torso aa.Volume = 2 aa:play() wait(1) if torso ~= nil then local torsoweld = Instance.new("Weld") torsoweld.Parent = torso torsoweld.Part0 = torsoweld.Parent torsoweld.Part1 = char.Torso torsoweld.C1 = CFrame.new(0, 0, 0) torso.Parent = char end aa = Instance.new("Sound") aa.SoundId = "http://www.roblox.com/asset/?id=262498455" aa.Parent = torso aa.Volume = 2 aa.Looped = true aa:play() wait(1) game:GetService("Chat"):Chat(me.Character.Head, "THIS IS MY POTENTIAL!!", Enum.ChatColor.Red) wait(0.5) me.Character.Humanoid.WalkSpeed = me.Character.Humanoid.WalkSpeed + 60 me.Character.Humanoid.MaxHealth = me.Character.Humanoid.MaxHealth + 500 me.Character.Humanoid.Health = me.Character.Humanoid.Health + 500 me.Levelss.Damage.Value = me.Levelss.Damage.Value + 200 wait(120) if char:findFirstChild("Chest") ~= nil then char.Chest:remove() end if char:findFirstChild("LArm") ~= nil then char.LArm:remove() end if char:findFirstChild("RArm") ~= nil then char.RArm:remove() end if char:findFirstChild("LLeg") ~= nil then char.LLeg:remove() end if char:findFirstChild("RLeg") ~= nil then char.RLeg:remove() end if char:findFirstChild("Horns") ~= nil then char.Horns:remove() end game:GetService("Chat"):Chat(me.Character.Head, "Gotta rest...", Enum.ChatColor.Green) me.Character.Humanoid.WalkSpeed = me.Character.Humanoid.WalkSpeed - 44 me.Character.Humanoid.MaxHealth = me.Character.Humanoid.MaxHealth - 500 me.Character.Humanoid.Health = me.Character.Humanoid.Health - 500 me.Levelss.Damage.Value = me.Levelss.Damage.Value - 200 wait(35) enabled = true end function onDe() char = bin.Parent.Parent.Character --if char:findFirstChild("ForceField") ~= nil then --char.ForceField:remove() --end local stuff = player.Character:getChildren() end function onSelected(mouse) print("Selected") mouse.Icon = "rbxasset://textures\\GunCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) end bin.Selected:connect(onSelected) bin.Deselected:connect(onDe)