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

Help with values?

Hello! Please can someone tell me what is wrong with this value/decal script please?

Thanks!

It doesn't switch images when a value is set. Please help me fix this problem!

Thanks!

Images:

http://oi58.tinypic.com/20s9co9.jpg http://oi61.tinypic.com/ajnuhl.jpg http://oi58.tinypic.com/9sdz5u.jpg

A script:

screen = script.Parent.Decal
 
while true do
    wait()
    if game.Workspace.A.Zig.Value == false then
    screen.Texture = "http://www.roblox.com/asset/?id=162925348"
    else   
    if game.Workspace.A.Zig.Value == true then
    screen.Texture = "http://www.roblox.com/asset/?id=162925339"
        end
    end
end

1 answer

The condition in the if is not necessary since the value can only either be true or false.

(Note that this isn't an error, it just makes your code cleaner)

while true do
	wait()
	if game.Workspace.A.Zig.Value == false then
		screen.Texture = "http://www.roblox.com/asset/?id=162925348"
	else
		screen.Texture = "http://www.roblox.com/asset/?id=162925339"
	end
end

According to the picture of the explorer you posted, Zig should be B (or you need to rename 'B' to 'Zig'). This is the source of your error.


Note that if you consult the output, you would be given such hints (that also help other us debug if you're stuck)

1 comment

0

Thanks for your help! Problem is now it is always stuck on the second texture and will never change. Please help again please? http://oi59.tinypic.com/waomfl.jpg http://oi58.tinypic.com/eba0iq.jpg http://oi59.tinypic.com/2j1aete.jpg Thanks! :)

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