Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help making a bindable function answer if something is nil or not? (read me)

I kind of don't know how to explain this (like usual). I am new to bindable functions so pls sympathize or don't cringe too much. I want my bindable function scripted to be invoked and find if something is nil or not. I thought about having an array like whatever = {true? - idk? , nil} but then how would I have it return if something is nil(false) or exists(true). ik i,v pairs so if it involves that then all I need to know is what would be in the parenthesis. Also I'm imagining this being in a local script in playerscripts. I kind of tried but it doesnt work. Lastly, maybe a module script makes more since so in that case warn me to use a module script in playerscripts instead.

how I would imagine trying to invoke

game.Players.PlayerAdded:connect(function(plr)
	i = false
	mouse = plr:GetMouse()
	plr.CharacterAdded:connect(function(chr)
		repeat
			wait()
			if plr:FindFirstChild('Script') then
				check = plr.PlayerScripts.LocalScript.target:Invoke(mouse.target)	
				while check == true do
					wait()
					-- idk at this point bcuz this is an example
				end
			end
		until i == true
	end)
end)

sry if this sounds rly stupid, i kinda just am starting to get what invoking and stuff is. - and what a bindablefunction is.

1 comment

0

...what are you trying to accomplish? At best this script seems to be doing the opposite thing that bindablefunctions should be used for

1 answer

A bindable function is literally just a bindable event that yields and can return something.

This is an example

--script1
local val = BindableFunction:Invoke('asdf')

--script2
function BindableFunction.OnInvoke(arg)
    if arg == 'asdf' then
        return true
    end
end

"I want my bindable function scripted to be invoked and find if something is nil or not" To check if a value is not nil, you do this: if value then --it exists! end

This discussion is preserved as it was. New answers, comments, and votes are closed.