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

How do you scan if a value = false?

Asked by 6 years ago

So I'm trying to make my script not work if the local player's sit value is true.

the directory is: game.Players.LocalPlayer.Humanoid.Sit

when I try to do:

() if game.Players.LocalPlayer.Humanoid.Sit = true then wait (999999) end

my actual script is down here ()

my script just doesn't work anymore. I need a way to basically ask my script, is the local character sitting down and if they are, wait (9999999)

Thank you! =D

P.S. (If you're wondering, I'm new at lua)

0
just add a boolvalue in to the player and check if its true or false DesiredRep 75 — 6y
0
could you give me an example of a boolvalue with my script please? nickos3 4 — 6y
0
May math.huge Ziffixture 6913 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

In comparing/testing for values, we don't use a single equal sign, but a double. A single equal sign is used to assign a variable:

Assigning a variable:

Comparing two values:

1if game.Players.LocalPlayer.Humanoid.Sit == true then
2    wait(1337)
3end
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
01local player = game.Players.LocalPlayer
02 
03local character = workspace:WaitForChild(player.Name)
04 
05while true do
06    if character.Humanoid.Sit == true then
07        wait(999999)
08    else
09        wait()
10    end
11end

This is a continuous loop variant of the sit value, however, you could check it whenever the player begins to sit or with another activated event like so.

01local player = game.Players.LocalPlayer
02 
03local character = workspace:WaitForChild(player.Name)
04 
05character.Humanoid.Changed:Connect(function()
06    if character.Humanoid.Sit == true then
07        wait(999999)
08    else
09        wait()
10    end
11end)

A single "=", as you attempted, is used to change values, while a double consecutive "==" is used to check if a value is equal to what comes after.

Answer this question