Why do some scripts not work in game? So annoying 200 lines, please look through and check if there is anything that wouldn't work IN GAME. Much appreciation -Doctorbeny2011
wait(0.5)
print("Setting up regeneration tool")
bin = script.Parent
local numleft = 12
local Reg = false
local autoOn = bin.AutoRegen
local autoTextures = {[true] = "31009287", [false] = "31009257"} --Something I learned from Ganondude
local ToolTextures = {"31009138","31008769","31008810","31008832","31008864","31008897","31008933","31008954","31009005","31009025","31009060","31009077","31009105"}
local TextureBase = "http://www.roblox.com/asset/?id="
local SkinColors = {"Pastel brown"}
local Faces = {"http://www.roblox.com/asset/?id=15268080", "http://www.roblox.com/asset/?id=7083354", "http://www.roblox.com/asset/?id=9291287", "http://www.roblox.com/asset/?id=7080026", "http://www.roblox.com/asset/?id=7083072"}
--Save copies of normal arm CFrames for regeneration of limbs
local rs0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
local rs1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
local ls0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
local ls1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
local rh0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
local rh1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
local lh0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
local lh1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
print("Variables done")
if (numleft > 12) then numleft = 12 end
bin.TextureId = TextureBase..ToolTextures[numleft+1]
nc1 = bin.Parent.Parent.Character.Torso.Neck.C1
function Regenerate(auto)
if (numleft > 0) and (bin.Parent.Parent.Character.Humanoid.Health == 0) and (autoOn.Value) then
bin.Parent.Parent.Character.Humanoid.Health = bin.Parent.Parent.Character.Humanoid.Health + 0.1
end
if (Reg) or (numleft == 0) or ((auto) and (autoOn.Value) and (bin.Parent.Parent.Character.Humanoid.Health > 1)) then return end
print("Regeneration attempted")
Reg = true
local player = bin.Parent.Parent
local guy = player.Character
local Torso = guy.Torso
if (auto) then guy.Humanoid.PlatformStand = true end
--If he is dead, save his life, but dont create an "if" argument
guy.Humanoid.Health = guy.Humanoid.Health + 0.1
if (Torso:findFirstChild("RegenSparkles") == nil) then
local rsp = script.Parent.ParticleEmitter:Clone()
rsp.Name = "RegenParticles"
rsp.Parent = Torso
end
wait(3)
if (guy.Humanoid.Health == 0) then return end --Do not continue if the player is dead
for i = 1,-.01 do
Torso.RegenParticles.Transparency = i
wait(.10)
end
Torso.RegenParticles.Enabled = true --Make him sparkly :D
guy.Humanoid.WalkSpeed = 10
print("Regeneration Initiated")
wait(60)
--Arms out!
if (guy:findFirstChild("Right Arm")) then
rc1 = Torso["Right Shoulder"].C1
Torso["Right Shoulder"].C1 = CFrame.new(0, 1.0, -0, 0, 0, 1, 0, 1, 0, -1, -0, -0)*CFrame.Angles(math.pi/5,0,0)
print("Right arm out")
end
if (guy:findFirstChild("Left Arm")) then
lc1 = Torso["Left Shoulder"].C1
Torso["Left Shoulder"].C1 = CFrame.new(0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)*CFrame.Angles(math.pi/5,0,0)
print("Left arm out")
end
--Head back!
Torso.Neck.C1 = nc1 * CFrame.fromEulerAnglesXYZ(1,0,0)
print("Head back")
wait(0.5)
--Make fire stream from his head and arms
local l1 = Instance.new("Fire")
l1.Parent = guy["Left Arm"]
l1.Heat = -25
local l2 = Instance.new("Fire")
l2.Parent = guy["Right Arm"]
l2.Heat = -25
local l3 = script.Parent.ParticleEmitter2:Clone()
l3.Parent = guy.Head
l3.Enabled = true
local s = script.Parent.Sound:Clone()
s.Parent = guy.Torso
s.Volume = 1
s:Play()
wait(7.5)
if (numleft == 0) then
--Kill him if he has used up all his regenerations (Should have been stopped at this point, but still)
guy.Humanoid.Health = 0
else
numleft = numleft - 1
bin.Name = "Regenerate (" ..tostring(numleft).. ")"
bin.TextureId = TextureBase..ToolTextures[numleft + 1]
--Time to change!!!!!!
local ChosenColor = BrickColor.new(SkinColors[math.random(1,#SkinColors)])
local HeadColor = guy.Head.BrickColor --This is assumed to be the players skin color.
local parts = guy:children()
for i = 1,#parts do
if (parts[i].className == "Part") and (parts[i].Name ~= "Regenergy") and (parts[i].BrickColor == HeadColor) then
parts[i].BrickColor = ChosenColor --Changes all body parts to random skin color
end
end
if (guy.Head:findFirstChild("face") ~= nil) then
guy.Head.face.Texture = Faces[math.random(1,#Faces)] --Changes face randomly
end
if (ChangeHead) then
if (guy.Head:findFirstChild("Mesh") ~= nil) then
guy.Head.Mesh:Remove()
end
bin.Heads:children()[math.random(1,#bin.Heads:children())]:clone().Parent = guy.Head --Random head shape
end
hold = false
guy.Humanoid.MaxHealth = 100 --Reset max HP to 100
wait(0.1)
guy.Humanoid.Health = 100 --Heal him
--REGENERATE A LIMB! IMPORTANT BIT!
if (not guy:findFirstChild("Right Arm")) then
local p = Instance.new("Part")
p.Name = "Right Arm"
p.Locked = true
p.CanCollide = false
p.formFactor = "Symmetric"
p.Size = Vector3.new(1,2,1)
p.BrickColor = ChosenColor
p.Parent = guy
local m = Instance.new("Motor6D")
m.C0 = rs0
m.C1 = rs1
m.Name = "Right Shoulder"
m.Part0 = guy.Torso
m.Part1 = p
m.Parent = guy.Torso
end
--REGENERATE A LIMB! IMPORTANT BIT!
if (not guy:findFirstChild("Left Arm")) then
local p = Instance.new("Part")
p.Name = "Left Arm"
p.Locked = true
p.CanCollide = false
p.formFactor = "Symmetric"
p.Size = Vector3.new(1,2,1)
p.BrickColor = ChosenColor
p.Parent = guy
local m = Instance.new("Motor6D")
m.C0 = ls0
m.C1 = ls1
m.Name = "Left Shoulder"
m.Part0 = guy.Torso
m.Part1 = p
m.Parent = guy.Torso
end
--REGENERATE A LIMB! IMPORTANT BIT!
if (not guy:findFirstChild("Right Leg")) then
local p = Instance.new("Part")
p.Name = "Right Leg"
p.Locked = true
p.CanCollide = false
p.formFactor = "Symmetric"
p.Size = Vector3.new(1,2,1)
p.BrickColor = ChosenColor
p.Parent = guy
local m = Instance.new("Motor6D")
m.C0 = rh0
m.C1 = rh1
m.Name = "Right Hip"
m.Part0 = guy.Torso
m.Part1 = p
m.Parent = guy.Torso
end
--REGENERATE A LIMB! IMPORTANT BIT!
if (not guy:findFirstChild("Left Leg")) then
local p = Instance.new("Part")
p.Name = "Left Leg"
p.Locked = true
p.CanCollide = false
p.formFactor = "Symmetric"
p.Size = Vector3.new(1,2,1)
p.BrickColor = ChosenColor
p.Parent = guy
local m = Instance.new("Motor6D")
m.C0 = lh0
m.C1 = lh1
m.Name = "Left Hip"
m.Part0 = guy.Torso
m.Part1 = p
m.Parent = guy.Torso
end
if (guy:findFirstChild("Animate")) then
guy.Animate:Remove()
end
bin.Animate:clone().Parent = guy --Reset the animation to work with the new limbs
for i,p in pairs(guy:children()) do
if (p.className == "CharacterMesh") then
local p2 = p:clone()
p:Remove()
wait()
p2.Parent = guy
end
end
wait(0.5)
guy.Humanoid.WalkSpeed = 16 --Reset walkspeed
--Disable the flames
l3.Enabled = false
l1:Destroy()
l2:Destroy()
--Set the flames to be removed after 3 seconds
wait(0.5)
Torso.Neck.C1 = nc1
if (rc1 ~= nil) then
Torso["Right Shoulder"].C1 = rs1
end
if (lc1 ~= nil) then
Torso["Left Shoulder"].C1 = ls1
end
Torso.RegenParticles.Enabled = false --Unsparkly D:
wait(1)
guy.Humanoid.PlatformStand = false
wait(1)
Reg = false
end
end
function onSelected(mouse)
print("Regeneration selected by " ..bin.Parent.Parent.Name)
mouse.KeyDown:connect(function(key)
if (key:lower() == "r") then
if (autoOn.Value == true) then autoOn.Value = false else autoOn.Value = true end
print("Automatic regeneration toggled to '" ..tostring(autoOn.Value).. "'")
bin.TextureId = TextureBase..autoTextures[autoOn.Value]
wait(2)
bin.TextureId = TextureBase..ToolTextures[numleft + 1]
end
end)
mouse.Button1Down:connect(function() Regenerate(false) end)
end
bin.Selected:connect(onSelected)
bin.Parent.Parent.Character.Humanoid.Changed:connect(function(prop)
if (autoOn.Value) and (prop == "Health") then
Regenerate(true)
end
end)

5 comments
Most of the time when people have this problem, it's because they're using the wrong type of script. If you're using a LocalScript, try using a regular Script, if you're using a regular Script, try using a LocalScript.
My REGULAR script is in a tool does this mean I can't pull this code off? Or?
Not sure...try this though: Go to your game (Not Studio), and once you try to use the tool, push F9. Tell me any red error messages you see. in the Local Output, and in the Server Output.
Sorry it's worked! Thanks for that simple tip! :)
Lol ok. No prob :P