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

[Solved] How can i make this variable be changed for the entire script?

Asked by 5 years ago
Edited 5 years ago

Tittle says it all. Here's the script:

Script:

game.ReplicatedStorage.HLC_CTRLS.W_Began.OnServerInvoke = function(player)
    W_KeyDown = true
    print("Remote function was invoked")
end

if(W_KeyDown)then
    print("Variable was changed.")

end

The first function prints, but the second doesn't. How can i make it be changed for the entire script?

1 answer

Log in to vote
0
Answered by 5 years ago

put the if inside the first function, or define W_KeyDown outside the function

0
Solved already. User#27525 1 — 5y
Ad

Answer this question