Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

function pie(num1, num2)

end

chicken = pie(0.4,0.5)

script.Parent.Transparency = chicken

0
why do you have two argument?also that function is n't doing anything you would have to return the value DemonAlastor 0 — 5y
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 robotnic123456789 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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
Ad

Answer this question