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

Help with values?

Asked by 10 years ago

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

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

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)

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! :) WelpNathan 307 — 10y
Ad

Answer this question