Gnago
|
  |
| Joined: 28 Jan 2014 |
| Total Posts: 372 |
|
|
| 11 Aug 2014 04:50 PM |
I need help please, more details after the script
script.Parent.Touched:connect(function(t) if t.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(t.Parent.Name) and t.Parent.Humanoid.Health > 0 then local g = game.ServerStorage.Terrains.Aqua.Kraken:Clone() g.Parent = Workspace g:MoveTo(Workspace.Thing.Spawnpoint.Position) end end)
ok, so What THIS script does is when the player touches the brick that holds this script, a model (In this script its "Kraken" which is inside of "Aqua" Which is in "Terrains") is teleported to the Brick "Spawnpoint" which is in the model "Thing"
Now, what I want is when the player touches the brick that holds this script, one of the 7 models inside of the model "Aqua" which is inside of "Terrains", is teleported to the Brick "Spawnpoint" which is in the model "Thing"
I got a small math.random script which I think can be edited in, but not sure if it will work.
local SelectedNumber = math.random(7) local ModelsToSelect = Aqua:GetChildren()
Help would be appreciated, Thanks!
I also have this script that someone made from this but it doesn't work, So if you find a mistake in this one, it might work. I'm uncertain about the #g on the 7th-ish line. youll see it...
deb = false script.Parent.Touched:connect(function(t) if deb == false then deb = true if t.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(t.Parent.Name) and t.Parent.Humanoid.Health > 0 then local g = game.ServerStorage.Terrains.Aqua:GetChildren() x = math.random(1,#g) g = game.ServerStorage.Terrains.Aqua[x] g.Parent = Workspace g:MoveTo(Workspace.Thing.FFF.Position) deb = false end end end)
This script was also given to me, but it is REALLY laggy (So that probably means it works), I cant even move my character in Play Solo, and I cant even get into the game via site. So if You can fix any of these That would be really great, This script is the Core of my game. Thanks!
deb = false script.Parent.Touched:connect(function(t) if deb == false then deb = true if t.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(t.Parent.Name) and t.Parent.Humanoid.Health > 0 then local g = game.ServerStorage.Terrains.Aqua:GetChildren()[math.random(#game.ServerStorage.Terrains.Aqua:GetChildren())] g.Parent = Workspace g:MoveTo(Workspace.Thing.FFF.Position) deb = false end end end)
Thanks so Much! You'll get a mention at the least and maybe your own character even (Though I don't think these rewards woul interest you much...)
Thank You!
|
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 11 Aug 2014 04:51 PM |
| much words much bored much complicated |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 11 Aug 2014 04:56 PM |
@ali
and you expect people to help you |
|
|
| Report Abuse |
|
|
Gnago
|
  |
| Joined: 28 Jan 2014 |
| Total Posts: 372 |
|
|
| 11 Aug 2014 05:43 PM |
| are you saying that to ali or agreeing with ali and saying that to me? |
|
|
| Report Abuse |
|
|
redroar
|
  |
| Joined: 30 Oct 2008 |
| Total Posts: 147 |
|
|
| 11 Aug 2014 06:09 PM |
Ok so I am not that good of a scripter but you wrote: local SelectedNumber = math.random(7) should it not be: local SelectedNumber = math.random(1, 7)
Sorry if this is wrong but if it is the I am glad I can help :) |
|
|
| Report Abuse |
|
|
Krypticon
|
  |
| Joined: 12 Feb 2014 |
| Total Posts: 680 |
|
|
| 11 Aug 2014 06:42 PM |
| math.random(7) works as well :) |
|
|
| Report Abuse |
|
|
redroar
|
  |
| Joined: 30 Oct 2008 |
| Total Posts: 147 |
|
| |
|