#I keep getting the error "Passed value is not a function" and I'm unable to figure out why...

1 messages · Page 1 of 1 (latest)

signal viper
#

Maybe I'm just missing something and am currently too tired to realize it, but I made custom functions that create new instances. However, going to call those functions with the player parameter (since it uses it to name the parts) gives me the error "Passed value is not a function." I'm confused because I have another script with the same code that works fine, so what's the issue with this one?

#

Here's the other script that also has custom functions and works. Why does this work and the other doesn't?

signal viper
# signal viper Maybe I'm just missing something and am currently too tired to realize it, but I...

Also here is the variables list which is at the top:

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local cursorVars = require(game.ReplicatedStorage:WaitForChild("cursorVars"))
local range = cursorVars.range
local HRP = player.Character:WaitForChild("HumanoidRootPart")
local camera = game.Workspace.CurrentCamera
local cursorParams = RaycastParams.new()
local dot;
local line;
local color;```
midnight canopy
#

if your functions themselves don't have any args

fringe basin
#

yeah

#

hold on just wondering which is an argument which is a parameter

#

arent the parameters set when the function is defined

midnight canopy
fringe basin
#

yeah so basically when you call your function your trying to pass in a value and your function doesn’t know what to do with it

signal viper
signal viper
#

Yep and idk why

fringe basin
#

Your not calling the function

#

Your just making another function

signal viper
#

Im not understanding...

fringe basin
#

The last line just makes another function

signal viper
#

So how do i call a function i've made beforehand

fringe basin
#

Without the function keyword

#

Literally just function()

#

Name of function()

signal viper
fringe basin
#

Function = example(parameter1 ,parameter 2)

#

to call it

#

to call it

#

example(argument1,argument2)

fringe basin
#

Which part u talking about

#

Yeah

signal viper
fringe basin
#

Which line

signal viper
fringe basin
#

You haven’t set any parameters in your function

#

Do you understand that

signal viper
#

I did end up trying to just put in all the parens (player) but it still didnt work

fringe basin
#

Where?

#

It sounds like you don’t know what a parameter is so I advise just watching a vid or looking over the docs

#

It’s pretty essential for functions

signal viper
#

i added a 'player' to the functions makeDot() and makeLine(), along with when they're called after 'chars' is checked

signal viper
fringe basin
#

Where you make the function

signal viper
#

Yea i ended up trying to put 'player' in all the parentheses

#

And still error'd

fringe basin
#

Try do it now and make it work and send code if u need help 😀

#

Good learning experience

signal viper
signal viper
midnight canopy
#

also can you copy n paste the error message here

#

"Passed value is not a function" doesnt seem like it'd go here

#

pretty sure luau would just ignore it anyways

midnight canopy
#

thats a different error

#

and you dont need player parameter or arg in your functions when its already a variable defined above

signal viper
#

o

fringe basin
#

also

#

Now you aren’t passing anything through when you call the function

signal viper
#

even when a param isnt used in function i still get same error

fringe basin
#

Send full code

#

Or u got any other codes

#

With a connect

signal viper
#

the first one is new and not working, second one is old and working

fringe basin
#

So disable the first?

#

Wait

#

No

#

I’ll check

#

Which one are u gonna use

signal viper
#

the second should be disabled

fringe basin
#

Disable the other

#

Is it disabled

midnight canopy
signal viper
#

im using the new one cuz its organized better and requires less outside parts like models

fringe basin
#

I see the error

#

It’s the last line

#

Yep

#

Remove the 2 brackets

midnight canopy
#

^

spark mangoBOT
#

studio** You are now Level 4! **studio

fringe basin
#

The ()

spark mangoBOT
#

studio** You are now Level 9! **studio

signal viper
#

oh that

midnight canopy
#

run.RenderStepped:Connect(getMouseData())

getMouseData() uses the RETURN of the function

run.RenderStepped:Connect(getMouseData)

getMouseData uses the FUNCTION itself

signal viper
#

i see

#

i forgot functions could return stuff

#

alright that was stupid of me but thanks

austere island
#

can u show the whple script

fringe basin