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: Powerup Adder

Previous Thread :: Next Thread 
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 05:10 AM
Hi, this doesn't seem to be working, I wondered if anyone could see the problem and fix it?

Thanks.


while true do
if game.Workspace.Values.PowerUps.Amount = < 6
then

local copy=game.Lighting.PowerUps:findFirstChild("ShinySwords"):clone()
copy.Parent=workspace
copy:makeJoints()

local xmaximum=20
local xminimum=-20
local zmaximum=20
local zminimum=-20

copy:moveTo(Vector3.new(math.random(xminimum,xmaximum), 0, math.random(zminimum,zmaximum)))
game.Workspace.Values.PowerUps.Amount = game.Workspace.Values.PowerUps.Amount + 1
end

wait(5)

end




Output:
Workspace.Scripts.Powerup Adder:2: unexpected symbol near '<'
Workspace.Scripts.Powerup Adder:2: 'then' expected near '='
Report Abuse
Brofessions is not online. Brofessions
Joined: 30 Jul 2012
Total Posts: 214
14 Aug 2012 05:27 AM
<=, the bracket goes first and then the equal sign
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 05:29 AM
Thanks!
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 05:31 AM
The Object doesn't seem to be cloning...?
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 05:44 AM
Any ideas?
Report Abuse
romaster512 is not online. romaster512
Joined: 13 Mar 2009
Total Posts: 1250
14 Aug 2012 05:46 AM
Try:
local copy=game.Lighting.PowerUps:FindFirstChild("ShinySwords")
copy:clone()
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 06:05 AM
Script is now


while true do
if game.Workspace.Values.PowerUps.Amount <=6
then


local copy=game.Lighting.PowerUps:FindFirstChild("ShinySwords")
copy:clone()
--[==[ local copy=game.Lighting.PowerUps:findFirstChild("ShinySwords"):clone()
copy.Parent=workspace
copy:makeJoints()

local xmaximum=20
local xminimum=-20
local zmaximum=20
local zminimum=-20

copy:moveTo(Vector3.new(math.random(xminimum,xmaximum), 0, math.random(zminimum,zmaximum)))
]==]
game.Workspace.Values.PowerUps.Amount = game.Workspace.Values.PowerUps.Amount + 1
end

wait(5)

end





Output: Workspace.Scripts.PowerUp Adder:2: attempt to compare userdata with number
Report Abuse
Brofessions is not online. Brofessions
Joined: 30 Jul 2012
Total Posts: 214
14 Aug 2012 06:10 AM
game.Workspace.Values.PowerUps.Amount.Value

Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 06:18 AM
Thanks.


Output is now:

Workspace.Scripts.Powerup Adder:19: attempt to perform arithmetic on field 'Amount' (a userdata value)


Current Script: while true do
if game.Workspace.Values.PowerUps.Amount.Value <=6
then


local copy=game.Lighting.PowerUps:FindFirstChild("ShinySwords")
copy:clone()
--[==[ local copy=game.Lighting.PowerUps:findFirstChild("ShinySwords"):clone()
copy.Parent=workspace
copy:makeJoints()

local xmaximum=20
local xminimum=-20
local zmaximum=20
local zminimum=-20

copy:moveTo(Vector3.new(math.random(xminimum,xmaximum), 0, math.random(zminimum,zmaximum)))
]==]
game.Workspace.Values.PowerUps.Amount = game.Workspace.Values.PowerUps.Amount + 1
end

wait(5)

end
Report Abuse
Brofessions is not online. Brofessions
Joined: 30 Jul 2012
Total Posts: 214
14 Aug 2012 06:26 AM
Do the same thing, but with that line
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 06:40 AM
Oh yes I see, thanks.
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 06:43 AM
Would this work?

local copy=game.Lighting.PowerUps:FindFirstChild("ShinySwords")
clone=copy:clone()
clone.Name = "ShinySwordsPU"
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 06:58 AM
Also, I can't see the model anywhere.
Report Abuse
MrChickens is not online. MrChickens
Joined: 21 Feb 2009
Total Posts: 1076
14 Aug 2012 06:58 AM
clone.Parent = game.Workspace
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 07:00 AM
Thanks.


I would like them to appear in random places in the map, not just in one place?
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 07:03 AM
Because currently they just appear in one place.
Report Abuse
MrChickens is not online. MrChickens
Joined: 21 Feb 2009
Total Posts: 1076
14 Aug 2012 07:07 AM
--Map Boundaries--
x = 50
z = 50
--Code--

clone=game.Lighting.PowerUps:FindFirstChild("ShinySwords"):Clone()
clone.Name = "ShinySwordsPU"
clone.Parent = game.Workspace
clone:MoveTo(Vector3.new(math.random(-x,x), 10, math.random(-z,z)))
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 07:14 AM
Thanks!

For some reason, it seems to be spawning 7 in total, not 6.


Does anyone know why?
Report Abuse
Lightmaster9 is not online. Lightmaster9
Joined: 14 May 2009
Total Posts: 8659
14 Aug 2012 07:17 AM
The line above "wait(5)" hast he mistake. You missed ".Value" and "Amount" in the first part before the "="
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 07:55 AM
That is fixed. Thanks


But does anyone know why it clones 7 models rather than 6?
Report Abuse
leatestest is not online. leatestest
Joined: 29 Apr 2009
Total Posts: 61
14 Aug 2012 08:56 AM
?
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