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

how do i get this function/script to work? im trying to make it transparent


function pie(num1, num2)

end

chicken = pie(0.4,0.5)

script.Parent.Transparency = chicken

2 comments

0

why do you have two argument?also that function is n't doing anything you would have to return the value

0

i thought having two arugments is alright for a script how to i also return it properly? im trying to get into scripting but the function argument things are confusing me

1 answer

I have no idea what pie() is supposed to do but I'm just gonna assume it adds 2 numbers together.

To do that, we can do:

local function pie(num1, num2)
	local x = num1 + num2
	return x -- returning means whenever the function is called, it is basically "replaced" in the statement with whatever value x has
end

chicken = pie(0.4,0.5) -- so pie(0.4,0.5) here becomes 0.9 because x in the function is 0.4 + 0.5 = 0.9 

script.Parent.Transparency = chicken

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