CptBenge
|
  |
| Joined: 22 Jun 2012 |
| Total Posts: 823 |
|
|
| 31 Oct 2012 12:38 PM |
Here are a few Scripts that are broken and need fixing for a game I have. I have tried to fix these and I'm just learning LUA Language. Anyone Help Please?
Hunger kills if "hunger" value 0. ----------------------------------------------- while true do if script.Parent.hunger.Value == 0 then function kill(h) h.Health = 0 end end ------------------------------------------------
This Scripts random spawns you when you enter game from Vector3 location. ------------------------------------------------ while wait(9) do local a=Instance.new("Part",game.Workspace) a.Position=Vector3.new(math.random(9,15),1,1) end ------------------------------------------------
Part of Random Zombie Spawn From Vector3 Location. ------------------------------------------------ while true do local zombie1 = game.Lighting.Zombies.Zombie1.Zombie:clone() position=Vector3.new(math.random(9,15),1,1) end --------------------------------------------------
~CptBenge
|
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 31 Oct 2012 12:48 PM |
while true do if script.Parent.hunger.Value == 0 then --Define h then this will work h.Health = 0 end ------------------------------------------------
This Scripts random spawns you when you enter game from Vector3 location. ------------------------------------------------ while wait(9) do -- Place a brick at a random location every 9 seconds. local a = Instance.new("Part", workspace) a.Position = Vector3.new(math.random(9,15),1,1) end ------------------------------------------------
Part of Random Zombie Spawn From Vector3 Location. ------------------------------------------------ while true do -- should be fine. local zombie1 = game.Lighting.Zombies.Zombie1.Zombie:clone() zombie1.Parent = workspace zombie1:MakeJoints() zombie1:MoveTo(Vector3.new(math.random(9,15),1,1)) end
next time post the errors. |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2012 12:50 PM |
while true do if script.Parent.hunger.Value == 0 then function kill(h) h.Health = 0 wait() end end -------------
while true do local zombie1 = game.Lighting.Zombies.Zombie1.Zombie:clone() zombie1.Parent = game.Workspace position=Vector3.new(math.random(9,15),1,1) wait() end
~+CClone+~
|
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 31 Oct 2012 12:50 PM |
| I should have added in those wait()s and that extra end, woops. |
|
|
| Report Abuse |
|
|
CptBenge
|
  |
| Joined: 22 Jun 2012 |
| Total Posts: 823 |
|
| |
|
CptBenge
|
  |
| Joined: 22 Jun 2012 |
| Total Posts: 823 |
|
|
| 31 Oct 2012 01:08 PM |
On this script it seems a bit confusing.
What I wanted this script to do is when a player enters the game it spawns them at random from vector3 Location. But within the map.
This Scripts random spawns you when you enter game from Vector3 location. ------------------------------------------------ while wait(9) do local a = Instance.new("Part", workspace) a.Position = Vector3.new(math.random(9,15),1,1) end |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 31 Oct 2012 01:17 PM |
"local a = Instance.new("Part", workspace)"
"What I wanted this script to do is when a player enters the game it spawns them at random from vector3 Location. But within the map."
what? |
|
|
| Report Abuse |
|
|
HaxHelper
|
  |
| Joined: 19 Dec 2009 |
| Total Posts: 1208 |
|
|
| 31 Oct 2012 01:18 PM |
| I think he wants to teleport players to random points on the map. For that, it would probably be best if you had a table of Vector3 positions and then look up one of those to move a player to. |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 31 Oct 2012 01:37 PM |
| Well if your doing it that way you may just want to place a bunch of spawn points down and roblox will do that rest. |
|
|
| Report Abuse |
|
|
CptBenge
|
  |
| Joined: 22 Jun 2012 |
| Total Posts: 823 |
|
|
| 31 Oct 2012 01:40 PM |
I'll try explain it more.
This script is ment to do this. When a Player enters the game it teleports/spawns them randomly. Not on a spawn point. |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 31 Oct 2012 01:43 PM |
| Well that is totally different from the script you posted for fixing, you need to use a Child Added or Player Joined function then use MoveTo(math.random(-Whatever, whatever), math.random(-Whatever, whatever), math.random(-Whatever, whatever)) |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2012 01:44 PM |
Players.PlayerAdded:connect(function(p) Delay(.5,function()p:LoadCharacter()end) p.CharacterAdded:connect(function(c) c:MoveTo(Vector3.new(math.random(-300,300),15,math.random(-300,300)) end) end)
wat |
|
|
| Report Abuse |
|
|