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

Variable and script questions?

Asked by 10 years ago

So I'm creating this script that a vehicle will only move when you press 'R' to start it. The delay is about 4 seconds because of the sound it makes. Second question, how do I make a global variable (as in it can be called from different scripts.) Thanks

2 answers

Log in to vote
0
Answered by
wrenzh 65
10 years ago

I don't quite understand what your first question is.

As for your second one, a global variable is defined with "_G." before the variable name.

For example, if you wanted to make a variable x into a variable that can be called from other scripts, you would make it _G.x

Ad
Log in to vote
0
Answered by
c0des 207 Moderation Voter
10 years ago
function keydown(key)
  if key == "r" then
    wait(4)
    --Right here, add your car movement properties.
  end
end

game.Players.LocalPlayer:GetMouse().KeyDown:connect(keydown)

Answer this question