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: New to scripting, need a bit of help

Previous Thread :: Next Thread 
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
28 Jun 2014 01:39 PM
I know VERY little about scripting. I wanted to make a script where when someone dies from an explosion, their body is replaced with a gore model and acted as their dead body parts. Anybody know if this is possible? (I made the gore myself)
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
28 Jun 2014 01:41 PM
For example: Team Fortress 2, when someone is shot with an explosive, their body explodes into bits and flies in all directions
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
28 Jun 2014 01:48 PM
...
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
28 Jun 2014 02:04 PM
Nobody knows how to do this? This is painful.
Report Abuse
GreatOculus is not online. GreatOculus
Joined: 30 Aug 2009
Total Posts: 2103
28 Jun 2014 02:07 PM
You could call Humanoid.Died and then

for i=1, 10 do
local p = Instance.new("Part", game.Workspace)
p.FormFactor = "Custom"
p.Size = Vector3.new(math.random(0.1, 1), math.random(0.1, 1), math.random(0.1, 1))
p.Position = Humanoid.Parent.Torso
end

That's just a write up, but the general idea is there.
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
28 Jun 2014 02:18 PM
I kinda see...
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
30 Jun 2014 10:39 PM
I think it finally formed in my head.
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
30 Jun 2014 10:49 PM
something like this might be hard for you, I would go to the wiki cookbook. Lots of examples there
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
30 Jun 2014 10:58 PM
I'll check it out.
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
30 Jun 2014 11:18 PM
function OnDeath() -- When someone dies
wait(.001)
i = game.Lighting.GoreModel:clone() -- Clones a model of gruesome gore
i.Parent = Workspace
i:MoveTo(Vector3.new(somenumber, somenumber, somenumber)) -- Supposed to be moved at place where character dies
end

I don't know what to put above the OnDeath() function. Like detecting when a character dies and how to remove the characters body before moving gory bits into workspace.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
30 Jun 2014 11:20 PM
It depends if you wanna use a Server script or a LocalScript.
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
01 Jul 2014 01:46 AM
I might have got it working.
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
01 Jul 2014 01:49 AM
If you want to check when the character has died, look at this example here:
http://wiki.roblox.com/index.php?title=Died_%28Event%29
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
01 Jul 2014 11:28 AM
print("Hello Noob!")

player = Workspace:FindFirstChild("Player")
humanoid = player.Humanoid

function OnDeath() -- when someone dies
wait(.00001)
print("HAHA")
if player then
pos = player.Head.Position
for _, v in ipairs(player:GetChildren()) do
if v:IsA('BasePart') then
v:Destroy()
end
end
i = game.Lighting.GoreModel:clone() -- clones a model of gruesome gore
i.Parent = Workspace
i:MoveTo(Vector3.new(pos.X, pos.Y - 1, pos.Z)) -- supposed to be moved at place where character dies
end
end

humanoid.Died:connect(OnDeath)

How do I make this script repeat? And how do I make it so it does it when every humanoid dies? (Even Zombies, or NPCs) I already have it working for regular characters just not "NPCs".
Report Abuse
luap2000 is not online. luap2000
Joined: 31 May 2014
Total Posts: 43
01 Jul 2014 11:36 AM
use a for loop or a repeat loop. for example i used a for loop below

function()
-- stuff here
end

for x = 0, 10 do
function()
end

change the number after the comma in the for loop to however many times you want it to do that function.

you can also use a boolean to control whether the function should keep running or not

running = true

while running do
function()
end

by setting running to true or false you can control at what times the function is constantly running if not as long as the server is running
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
01 Jul 2014 11:36 AM
I see
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
01 Jul 2014 12:05 PM
Anyone else know how to make a script repeat itself after it has done it once already? If that makes sense.
Report Abuse
GreatOculus is not online. GreatOculus
Joined: 30 Aug 2009
Total Posts: 2103
01 Jul 2014 12:30 PM
repeat
function()
until condition
Report Abuse
z0mbi3x1 is not online. z0mbi3x1
Joined: 04 Jul 2010
Total Posts: 137
01 Jul 2014 01:15 PM
All the repeating stuff keeps breaking the script. So I remove it. When I just leave it as it is and blow up a "Player", it does the thing. When I spawn another "Player", and blow him up, it doesn't do it anymore.
Report Abuse
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
01 Jul 2014 01:48 PM
If you're using game.Players.PlayerAdded and Humanoid.Died it should call a function whenever the Humanoid dies.
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