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: Spawn function requires 1 argument?

Previous Thread :: Next Thread 
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
02 Feb 2013 03:34 AM
I have this small error, where my Spawn() function 'requires 1 argument' when it's already got an argument. Here's the affected parts:

function checkPressed(btn)
btn.MouseButton1Down:wait()
mouse = game.Players.LocalPlayer:GetMouse()
clone = game.Lighting.insertParts[button.Text]:Clone()
wait()
clone.Parent = currcam
clone.Transparency = 0.5
mouse.TargetFilter = clone
dragging = true
wait()
while dragging do --set position until...
wait()
clone.Position = Vector3.new(math.floor(mouse.Hit.p.X), math.floor(mouse.Hit.p.Y), math.floor(mouse.Hit.p.Z))
wait()
mouse.Button1Down:connect(--mouse down
function()
dragging = false
clone.Parent = workspace
clone.Transparency = 0
drg = true
while drg do
wait()
mouse.Button1Up:connect(function()
mouse.TargetFilter = nil
drg = false
end
)
end
end
)
end
end
Spawn(checkPressed(button))
Report Abuse
Combrad is not online. Combrad
Joined: 18 Jul 2009
Total Posts: 11025
02 Feb 2013 05:05 AM
We need to see what Spawn() is
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
02 Feb 2013 05:19 AM
Spawn() basically does the same as coroutine.resume(coroutine.create()).
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
02 Feb 2013 05:20 AM
and Spawn() is a built in ROBLOX function.

http://wiki.roblox.com/index.php/Spawn()#Spawn
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
02 Feb 2013 05:21 AM
make sure spawn is written like this

Spawn = function(f)
coroutine.resume(coroutine.create(function()
f()
end))
end
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
02 Feb 2013 05:21 AM
oh lol
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
02 Feb 2013 05:22 AM
I don't need to. It's a built in ROBLOX function. Read the link that I posted.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
02 Feb 2013 05:23 AM
Actually, Spawn() might not be what I'm looking for:

Executes function f after thread next yields. The function f is called with 2 arguments: The elapsed time and the current game time.


After thread next yields... But I could just do spawn(function) wait().. Hm.
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