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

How to pass one argument through multiple functions?

Asked by
Seyfert 90
6 years ago
Edited 6 years ago

I need different conditions to be met in my script, I am going to keep it simple for you to understand but essentially my script is broken into different functions and at the final function I need the server to Invoke the client, but this requires me to pass the player as an argument, I try but I get "InvokeClient: player argument must be a Player object"

Here is my code

function onTouched(hit)
    local player = hit.Parent
    ----blah blah do other stuff, I didn't include it for simplicity
    checkPercentage(player) 
end

function checkPercentage(plr)
    local playah = plr
    ----blah blah do other stuff, I didn't include it for simplicity
    checkList(playah) --Trying to pass the same argument, is this possible?
end

function checkList(plr)
    local RemoteFunction = game.ReplicatedStorage:WaitForChild("RemoteFunction1")
    RemoteFunction:InvokeClient(plr) --When this executes I get "InvokeClient: player argument must be a Player object"
end








Answer this question