Discord
Login
Community
DARK THEME

how

If anybody in the community knows how can you create a variable to play a sound inside of the game

Do you mean playing a sound and having that equal a variable so you can control it?

test = audio.playSound("my_sound",1,1,0,true)
test.setVolume(0.5)

you can do

init = function()
 sound = false
end

update = function()
 if sound == true then
  audio.playSound("my_sound",1,1,0,true)
  sound = false
 end

end

then put sound on a toggle with

if keyboard.press.SPACE then sound = not sound end

Hope this helps!

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community