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

Serverscript wont detect NumberValue in ServerStorage?

Asked by 5 years ago

So inside a birck is this script:

1local AI = game.ServerStorage.FredAI.Value
2if AI == 1
3then
4 
5    print("Test")
6    script.Parent.Transparency = 1
7end

However, "Test" is never printed and the block never changed its transprency.

I know that the value changes, as I have a script to print the current value some time after the value is changed, and it says 1, also I hit run and watched the value chaged.

Any solutions?

0
You're going to need a loop if the AI value is changed after the game starts josestankor 39 — 5y
0
I also recommend you to move the value from ServerStorage to ReplicatedStorage josestankor 39 — 5y
0
wow.. coincidence? Hydrogyn 155 — 5y

1 answer

Log in to vote
2
Answered by
Hydrogyn 155
5 years ago
Edited 5 years ago

hello, Adenandpuppy. I've brought up a couple of solutions.

SOLUTION 1

Solution 1 is pretty simple you create a while true do loop to constantly check the value.

1local AI = game.ServerStorage.FredAI
2 
3while true do
4    wait()
5    if AI.Value == 1 then
6        script.Parent.Transparency = 1
7    end
8end

SOLUTION 2

If the script you are using is an localscript then you simply cannot access serverstorage. Instead use replicatedstorage as both normal scripts and localscripts can access the contents of it.

--

I hope this helps!

// hydrogyn

Ad

Answer this question