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 4 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

if game.Workspace.Value1.Value == 1 then
        game.Workspace.Sound4.Playing = true

    end

1 answer

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

Two things;

You play a sound with Sound:Play()

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

--Variables--
local value = game.Workspace:WaitForChild("Value1") --Pauses the script until Value1 loads in
local sound = game.Workspace:WaitForChild("Sound4") --Does the same for Sound4

if game.Workspace.Value1.Value == 1 then
    sound:Play()
end

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

Ad

Answer this question