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:

1game.ReplicatedStorage.HLC_CTRLS.W_Began.OnServerInvoke = function(player)
2    W_KeyDown = true
3    print("Remote function was invoked")
4end
5 
6if(W_KeyDown)then
7    print("Variable was changed.")
8 
9end

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