generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Time Lord Regeneration Script

Previous Thread :: Next Thread 
crabbybuildingblox is not online. crabbybuildingblox
Joined: 23 Nov 2010
Total Posts: 186
07 May 2014 08:14 AM
Well, the script is slightly long below, but when you click with the tool equipped, it's supposed to make your character throw his arms and head back, shoot fire out, and change his appearance by adding a random face and skin tone like in the TV show Doctor Who. For some reason, it works fine when I test it in Roblox Studio, but it doesn't seem to even affect the game when I actually click the 'Play' button. Help please?

Error guesses: Mouse sensing script could be outdated; overall script could be outdated; health feature could be incompatible with current health.


Anyways, here's the script:

local ChangeHead = false--This is whether the head mesh is changed

---------------------------------------------------------------------------------
----------------------------NO-CHANGE LINE-------------------------------
---------------------------------------------------------------------------------

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", "Brick yellow", "Bright orange", "Nougat", "Dark orange", "Pastel orange", "Medium red", "CGA brown"}
local Faces = {"http://www.roblox.com/asset/?id=156175604", "http://www.roblox.com/asset/?id=156175674", "http://www.roblox.com/asset/?id=156175790", "http://www.roblox.com/asset/?id=156175865", "http://www.roblox.com/asset/?id=156175918", "http://www.roblox.com/asset/?id=156175921", "http://www.roblox.com/asset/?id=156175926", "http://www.roblox.com/asset/?id=156176540", "http://www.roblox.com/asset/?id=156176542"}
--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 = Instance.new("Sparkles")
rsp.Name = "RegenSparkles"
rsp.Color = bin.SmokeColor.Value
rsp.Parent = Torso
rsp.Enabled = false
end
wait(1)
if (guy.Humanoid.Health == 0) then return end --Do not continue if the player is dead
Torso.RegenSparkles.Enabled = true --Make him sparkly :D
guy.Humanoid.WalkSpeed = 0
print("Regeneration Initiated")
wait(2)
--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")
if (guy:findFirstChild("Left Arm")) then
l1.Parent = guy["Left Arm"]
l1.Size = 5
l1.Heat = -20
end
local l2 = Instance.new("Fire")
if (guy:findFirstChild("Right Arm")) then
l2.Parent = guy["Right Arm"]
l2.Size = 5
l2.Heat = -20
end
local l3 = Instance.new("Fire")
l3.Parent = guy.Head
l3.Size = 5
l3.Heat = 20
wait(2)
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
l1.Enabled = false
l2.Enabled = false
l3.Enabled = false
--Set the flames to be removed after 3 seconds
game.Debris:AddItem(l1,3)
game.Debris:AddItem(l2,3)
game.Debris:AddItem(l3,3)
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.RegenSparkles.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)
Report Abuse
error9999 is not online. error9999
Joined: 05 Sep 2009
Total Posts: 1593
07 May 2014 09:22 AM
game.Players:findFirstChild(player.Name).Character.Humanoid.Health = 100

c:
Report Abuse
EcIiptic is not online. EcIiptic
Joined: 12 Aug 2009
Total Posts: 13737
07 May 2014 09:25 AM
yes

we are here to do your bidding and fix someone elses extremely long code

as you wish

#Piano
Report Abuse
crabbybuildingblox is not online. crabbybuildingblox
Joined: 23 Nov 2010
Total Posts: 186
07 May 2014 09:25 AM
Thanks, but I'm afraid I don't understand. Are you suggesting I add that into the script somewhere?
Report Abuse
crabbybuildingblox is not online. crabbybuildingblox
Joined: 23 Nov 2010
Total Posts: 186
07 May 2014 09:27 AM
I'll go press buttons...

or something....
Report Abuse
ninja5566 is not online. ninja5566
Joined: 14 Jan 2009
Total Posts: 5233
07 May 2014 09:52 AM
don't listen to anyone here.


add "wait()" at the top
Report Abuse
crabbybuildingblox is not online. crabbybuildingblox
Joined: 23 Nov 2010
Total Posts: 186
07 May 2014 11:07 AM
I wonder if repeat wait() until game.Players.LocalPlayer would work...
Report Abuse
ninja5566 is not online. ninja5566
Joined: 14 Jan 2009
Total Posts: 5233
07 May 2014 11:56 AM
fun fact: Local scripts do NOT work without "wait()" at the top.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image