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

I can't check if an int value is 1 in the workspace, any clues?

Asked by 5 years ago

I'm very new to scripting and i can't figure out how to detect if an int value is 1. I don't see what is wrong with this script

1if game.Workspace.Value1.Value == 1 then
2        game.Workspace.Sound4.Playing = true
3 
4    end

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Two things;

You play a sound with Sound:Play()

You should use game.Workspace:WaitForChild("Value1")

1--Variables--
2local value = game.Workspace:WaitForChild("Value1") --Pauses the script until Value1 loads in
3local sound = game.Workspace:WaitForChild("Sound4") --Does the same for Sound4
4 
5if game.Workspace.Value1.Value == 1 then
6    sound:Play()
7end

p.s: You can use the keyword workspace when referring to game.Workspace in a script!

Ad

Answer this question