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 » Scripters
Home Search
 

Re: Table, Passed Value is not a function(TEXT BUTTON TABLE)

Previous Thread :: Next Thread 
bondhemlig is not online. bondhemlig
Joined: 24 Jan 2013
Total Posts: 264
12 May 2017 12:10 PM
Hey i have made a script that inserts 1o#######uttons into a table. Problem is when I'm trying to call a function when you press them it says and gives me the error: Attempt to connect failed: Passed value is not a function
It gives me the error for all of the table values. I don't see any wrong. So basically whats wrong!?
Im trying to do a code lock btw.
Heres my WHOLE script:
--made by bondhemlig
a=script.Parent
Tes=a.Tes
Nums=a.Numbers:GetChildren()
CodeBar=a.CodeBar
nums={}
Cleare=a.Clear
wait()
for i,v in pairs(Nums)do
if v:IsA("TextButton")then
v.Text = v.Name
table.insert(nums, v)
print(v.ClassName)
end
end
print(nums[1].Name, nums[2].Name, nums[3].Name, nums[4].Name, nums[5].Name, nums[6].Name, nums[7].Name, nums[8].Name,nums[9].Name, nums[10].Name)
wait(1)
function Numbers(num)
Tes.Value = num.Name
end

function Change()
CodeBar.Text = a.CodeBar.Text..Tes.Value
end
function Clear()
CodeBar.Text = "Cleared"
wait(1)
CodeBar.Text =""
Tes.Value =""
end
wait(1)
Clear()
Cleare.MouseButton1Click:connect(Clear)
Tes.Changed:connect(Change)
nums[1].MouseButton1Click:connect(Numbers(nums[1]))
nums[2].MouseButton1Click:connect(Numbers(nums[2]))
nums[3].MouseButton1Click:connect(Numbers(nums[3]))
nums[4].MouseButton1Click:connect(Numbers(nums[4]))
nums[5].MouseButton1Click:connect(Numbers(nums[5]))
nums[6].MouseButton1Click:connect(Numbers(nums[6]))
nums[7].MouseButton1Click:connect(Numbers(nums[7]))
nums[8].MouseButton1Click:connect(Numbers(nums[8]))
nums[9].MouseButton1Click:connect(Numbers(nums[9]))
nums[10].MouseButton1Click:connect(Numbers(nums[10]))

Help would be appreciated thanks!
Report Abuse
bondhemlig is not online. bondhemlig
Joined: 24 Jan 2013
Total Posts: 264
12 May 2017 03:51 PM
Anyone got any clue to why this error pops up?
Report Abuse
vivivio is online. vivivio
Joined: 23 Jan 2012
Total Posts: 707
12 May 2017 03:57 PM
boi use for instead of indexing each individual object
Report Abuse
vivivio is online. vivivio
Joined: 23 Jan 2012
Total Posts: 707
12 May 2017 03:59 PM
also change (Numbers(nums[index])) to (Numbers)
Report Abuse
bondhemlig is not online. bondhemlig
Joined: 24 Jan 2013
Total Posts: 264
12 May 2017 04:02 PM
Yes but i wanna give num in numbers function that value/argument
How do i do that?
Report Abuse
vivivio is online. vivivio
Joined: 23 Jan 2012
Total Posts: 707
12 May 2017 04:06 PM
the :connect( function ) it needs a function there to call it, nothing else
Report Abuse
bondhemlig is not online. bondhemlig
Joined: 24 Jan 2013
Total Posts: 264
13 May 2017 03:30 AM
But still how do i give the parameter "num" the argument of the clicked textbutton?
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
13 May 2017 03:46 AM
inside Numbers

function Numbers(num)
return function()
Tes.Value = num.Name
end
end


Report Abuse
hunxrepair is online. hunxrepair
Joined: 07 Aug 2011
Total Posts: 777
13 May 2017 04:05 AM
(NOTE: I'm a bit confused to what you're trying to do)
You can't do that
nums[10].MouseButton1Click:connect(Numbers(nums[10]))
You can only
nums[10].MouseButton1Click:connect(Numbers)



If you want to pass any additional arguments, you can't. Instead, you do this:


-- AN EXAMPLE
function NewPlayer(Player, IsItNoob, Number, AnotherNumber)
print(Player.Name)
print(IsItNoob)
print(AnotherNumber)
end

game.Players.PlayerAdded:Connect(function(Player)
NewPlayer(Player, "nooob", 2, 3)
end)



---------------------- What you need to do in your own code
function Numbers(SomeNumber)

end

nums[1].MouseButton1Click:Connect(function()
Numbers(nums[1])
end)






Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
13 May 2017 04:07 AM
Just use mine.


Report Abuse
bondhemlig is not online. bondhemlig
Joined: 24 Jan 2013
Total Posts: 264
13 May 2017 04:07 AM
Im trying to make like a code door, where you have to enter the code. Just a more clever way other than connecting all the 10 number functions. Thanks that works as well!
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