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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Boat Regenerate Script

Previous Thread :: Next Thread 
ElliottPika is not online. ElliottPika
Joined: 24 Jun 2011
Total Posts: 85
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
ElliottPika is not online. ElliottPika
Joined: 24 Jun 2011
Total Posts: 85
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
ElliottPika is not online. ElliottPika
Joined: 24 Jun 2011
Total Posts: 85
26 Jul 2015 02:54 PM
Bump?


+1 Forum Post
Report Abuse
TimeTicks is not online. 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
ElliottPika is not online. ElliottPika
Joined: 24 Jun 2011
Total Posts: 85
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
ElliottPika is not online. ElliottPika
Joined: 24 Jun 2011
Total Posts: 85
26 Jul 2015 03:53 PM
Should I be posting this in another forum?


+1 Forum Post
Report Abuse
SuperRoblox893 is not online. SuperRoblox893
Joined: 01 Jun 2014
Total Posts: 634
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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