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

Intvalue wont change in a script, can anyone help?

I am trying to make an imagelabel change if an intvalue's value is 1, if not it prints the value chosen.

The error occurs on line 3, this is the error, "Decals is not a valid member of ServerStorage "ServerStorage" "

local SS = game.ServerStorage

local DecalsList = SS.Decals

local Value = script.Parent.Value.Value

Value.Value = math.random(0,10)

print(Value)

if Value == 1 then
	script.Parent.Image = SS.Decals.MakatoNaegi.Texture
	print("MakatoNaegi Choosen!")
end

2 answers

✓ Accepted answer

This means that there are no Decals on ServerStorage You can check this by looking at the ServerStorage via the explorer while testing the place.

If you see Decals on ServerStorage then please try using this in a script if it works. (You can't access the ServerStorage using a local script find out more in https://scriptinghelpers.org/guides/server-client-relationship-in-roblox)

local ss = game:GetService("ServerStorage")
local dl = ss:WaitForChild("Decals")
local v = script.Parent.Value.Value

v.Value = math.random(0,10)

print(v)

if v == 1 then
	script.Parent.Image = ss.Decals.MakatoNaegi.Texture
	print("MakatoNaegi Choosen!")
end

4 comments

0

Thanks! But i do have a question, in the output it printed out "value" instead of the actual number.

0

my question is why?

0

I don't know why you have two value in "script.Parent.Value.Value", its confusing, but v.Value is basically the value of "script.Parent.Value.Value". so if u want to print the actual number its v.Value instead of just v

0

Oh, makes a lot of sense actually, thanks!

this means you forgot to put Decals into the ServerStorage. Or is this a LocalScript? If so then client cannot access contents of the storage, only server can, instead as a client storage use ReplicatedStorage.

Also on line 5 you are setting [Value] variable to current IntValue's Value but on line 7 you are then indexing it's Value? That won't work, try this instead:

...
local Value = script.Parent.Value

Value.Value = math.random(0,10)
...

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