|
| 25 Jul 2015 10:12 PM |
I'm trying to make a tycoon which will have boat docks you can purchase in them. For some reason, when there is more than one tycoon in the workspace, the boats will not spawn. Like, the regen button won't even react. The game will have 6 tycoons, by the way.
For example, let's say we have 2 tycoons in the Workspace...
Tycoon #1's Boat Regen script is like this:
local WaitTime = 10 local MaxDistance = 25 local ModelPartName = "Move" local modelname = "Boat1"
modelbackupclone = script.Parent.Parent:FindFirstChild(modelname) modelbackup = modelbackupclone:Clone() local spawnpoint = Vector3.new(modelbackup:FindFirstChild(ModelPartName).Position) local trigger = script.Parent
script.Parent.Parent:FindFirstChild(modelname):Destroy()
enabled = true
function getDistance() local b = true local c = game.Workspace:GetChildren() for i = 1, #c do if c[i].Name == modelname then local p = c[i]:FindFirstChild(ModelPartName,true) if p ~= nil then local dist = (p.Position - spawnpoint).magnitude if dist < MaxDistance then b = false return b else end end end end return b end
function onClick() if enabled == true then gooddistance = getDistance() if gooddistance == true then enabled = false trigger.BrickColor = BrickColor.new("Really black") local modelclone = modelbackup:clone() modelclone.Parent = script.Parent.Parent modelclone:MakeJoints() wait(WaitTime) enabled = true trigger.BrickColor = BrickColor.new("Bright violet") end end end
script.Parent.ClickDetector.MouseClick:connect(onClick)
Regen #2 is the same, except Boat1 is known as Boat2
Is there anything I'm doing wrong? Please respond if there is. Also, remember that there will be 6 tycoons.
Please do not hesitate to ask me any questions that will help solve this problem (provided that I know the answer).
|
|
|
| Report Abuse |
|
|
|
| 26 Jul 2015 02:47 PM |
Also, the error I get is: Workspace.Tycoon1.Factory.Boat.Part.Regen:11: attempt to index global 'modelbackupclone' (a nil value)
So, does anyone have an answer for this problem?
ElliottPika
+1 Forum Post |
|
|
| Report Abuse |
|
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 26 Jul 2015 02:56 PM |
we don't fix free mods.
"Talk is cheap. Show me the code." - Linus Torvalds |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2015 03:01 PM |
So you don't know the answer, or you just don't want to help me?
It's not a free modelled script, by the way. If you think it's a free model based on the first four lines, I added those because I'm using this same script for 6 different tycoons which use different numbers at the end of the boat's name.
ElliottPika
+1 Forum Post |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2015 03:53 PM |
Should I be posting this in another forum?
+1 Forum Post |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2015 05:57 PM |
Dunno if you mean this: http://wiki.roblox.com/index.php?title=How_to_Make_a_Model_Regenerate |
|
|
| Report Abuse |
|
|