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: Calling function variables

Previous Thread :: Next Thread 
stefi51 is not online. stefi51
Joined: 28 Feb 2010
Total Posts: 1105
25 Oct 2012 06:11 PM
function stick(x, y)
ply = script.Parent.Parent.Parent.Character
stick(ply.Torso,LolAModel.Seat)
weld = Instance.new("Weld")
weld.Part0 = x
weld.Part1 = y
local HitPos = x.Position
local CJ = CFrame.new(HitPos)
local C0 = x.CFrame:inverse() *CJ
local C1 = y.CFrame:inverse() * CJ
weld.C0 = C0
weld.C1 = C1
weld.Parent = x
end

I need help with this weld function.. It needs to weld 2 parts together
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
25 Oct 2012 06:14 PM
You called the function inside the function.

function stick(x, y)
ply = script.Parent.Parent.Parent.Character
weld = Instance.new("Weld")
weld.Part0 = x
weld.Part1 = y
local HitPos = x.Position
local CJ = CFrame.new(HitPos)
local C0 = x.CFrame:inverse() *CJ
local C1 = y.CFrame:inverse() * CJ
weld.C0 = C0
weld.C1 = C1
weld.Parent = x
end

stick(ply.Torso, Workspace.LolAModel.Seat)
Report Abuse
stefi51 is not online. stefi51
Joined: 28 Feb 2010
Total Posts: 1105
25 Oct 2012 06:15 PM
Expand..?
How do the function variables work?
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
25 Oct 2012 06:16 PM
function math(x, y)
print(x + y)
end

math(3, 4)

>7
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
25 Oct 2012 06:16 PM
It basically sets Variables to it.


So since it's

function stick(x,y)

end


You would call it with

stick(workspace.Part1,workspace.Part2)

So INSIDE The Function, it sets Variables up

x = workspace.Part1
y = workspace.Part2
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