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

How would I go on about checking multiple values every second?

Asked by
2_MMZ 1059 Moderation Voter
3 years ago

Hello. I am making a game that each level is unlocked if the value is a certain value. Any working answer is appreciated. Here is my script.

local playerlevels = game.ReplicatedStorage.Values:WaitForChild("thelevels")



while true do
    wait(1)
    print("check complete.")
if playerlevels.Value == 1 then
    game.Workspace.livingroom.bedroomdoor.bedroomdoor.ClickDetector.MaxActivationDistance = 15000
end

if playerlevels.Value == 2 then
    game.Workspace.office.bedroomdoor.bedroomdoor.ClickDetector.MaxActivationDistance = 15000
end

if playerlevels.Value == 3 then
    game.Workspace.basement.bedroomdoor.bedroomdoor.ClickDetector.MaxActivationDistance = 15000
end

if playerlevels.Value == 4 then
    game.Workspace.attic.bedroomdoor.bedroomdoor.ClickDetector.MaxActivationDistance = 15000
end
end

Whenever I run the script, and change the value, it does not change the MaxActivDistance.

0
game.ReplicatedStorage.Values line seems sus. I'm prob wrong Xyternal 247 — 3y
0
its the folder 2_MMZ 1059 — 3y
0
ohhhh Xyternal 247 — 3y
0
Try doing game.Workspace.attic.bedroomdoor.bedroomdoor.ClickDetector.MaxActivationDistance == 15000. I don't think that its right, but try that Xyternal 247 — 3y
0
No, because that is used in an IF statement. 2_MMZ 1059 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

Use a while true do loop properly

Ad

Answer this question