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: Script Help

Previous Thread :: Next Thread 
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
31 May 2013 05:10 PM
Trying to make a map changer using InsertService,
Any help?

while true do
ids = {84350087,78235041}
local map = math.random(1, #ids)
game:GetService("InsertService"):Insert(map)
map:MoveTo(Vector3.new(-81, 40.7, 20))
wait(10) -- I will change the time, this is just a test
map:destroy()
end
Report Abuse
ElectricThundah is not online. ElectricThundah
Joined: 28 May 2013
Total Posts: 3081
31 May 2013 05:15 PM
Wow, you are all better scripters then me o.e
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
31 May 2013 05:17 PM
I'm not even sure if that is a correct function, I'm still learning myself haha!

Anyways, for those helping, this is the output!

23:16:05.189 - Unable to cast value to Object
23:16:05.189 - Script "Workspace.MapScript", Line 4
23:16:05.189 - stack end
Report Abuse
ElectricThundah is not online. ElectricThundah
Joined: 28 May 2013
Total Posts: 3081
31 May 2013 05:18 PM
Does it need 2 ends?
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
31 May 2013 05:21 PM
No, here's a tip, there's usually a "-" next to some words in blue, however many dashes there are within the lines your writing of that function, that is how many ends there must be

e.g.
- function ontesting()
- if bla bla bla then
stuff here

end
end

--- Notice how I've put two ends because there is two dashes.
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
31 May 2013 05:22 PM
I've edited the script, and this is the output now:

23:22:10.584 - Workspace.MapScript:6: attempt to index local 'map' (a number value)
23:22:10.594 - Script "Workspace.MapScript", Line 6
23:22:10.594 - stack end


Here is the script code:
while true do
ids = {84350087,78235041}

local map = math.random(1, #ids)
game:GetService("InsertService"):LoadAsset(map)
map.Parent = game.Workspace
map:MoveTo(Vector3.new(-81, 40.7, 20))
wait(10) -- position here
map:destroy()
end
Report Abuse
ElectricThundah is not online. ElectricThundah
Joined: 28 May 2013
Total Posts: 3081
31 May 2013 05:23 PM
My first script had a function later in... and it didn't have a '-' at the start..?
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
31 May 2013 05:24 PM
I don't exactly know if this is your issue, but I believe it should be changed.
It should cause issues when it comes to using the variable.
local map = math.random(1, #ids)
Using :Insert() wouldn't work how you would want it to.

So..

while true do
ids = {84350087,78235041}
local mp = math.random(1, #ids)
map = game:GetService("InsertService"):LoadAsset(ids[mp])
map.Parent = Workspace
map:MoveTo(Vector3.new(-81, 40.7, 20))
wait(10) -- I will change the time, this is just a test
map:destroy()
end

I believe that should be correct, or at least closer to being correct.
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
31 May 2013 05:24 PM
No the little "-" is within the margin, next to the number lines
It's like this:

1 - function blabla()
2
3
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
31 May 2013 05:25 PM
Yeah, Insert() wouldn't work, LoadAsset is better, I'll test this! Thanks.
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
31 May 2013 05:26 PM
Excellent, works! Thanks for your help.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
31 May 2013 05:27 PM
No problem. Best of luck with your game!
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
31 May 2013 05:29 PM
Thank you! Guess you've heard of it then, haha has become a popular post within game design.
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