Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Serverscript wont detect NumberValue in ServerStorage?

So inside a birck is this script:

local AI = game.ServerStorage.FredAI.Value
if AI == 1
then
	 
	print("Test")
	script.Parent.Transparency = 1
end

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?

3 comments

0

You're going to need a loop if the AI value is changed after the game starts

0

I also recommend you to move the value from ServerStorage to ReplicatedStorage

0

wow.. coincidence?

1 answer

✓ Accepted answer

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.

local AI = game.ServerStorage.FredAI

while true do
	wait() 
	if AI.Value == 1 then
		script.Parent.Transparency = 1
	end
end

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

This discussion is preserved as it was. New answers, comments, and votes are closed.