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

Open Gui On Click and Change Image Not Working?

Asked by 4 years ago
Edited 4 years ago

So, hello! I was making a menu GUI. I finished coding and went to test. Nothing happened. (Local Script) Code:

-- The IDs
openid = "5232239597"
closeid = "5232247205"

script.Parent.MouseButton1Click:Connect(function()
    if script.Parent.Image == "http://www.roblox.com/asset/?id="..openid then -- If its the open button
        script.Parent.Parent.MenuOptions.Visible = true
        script.Parent.Image = "http://www.roblox.com/asset/?id="..closeid -- Open and set it to close
    end
    if script.Parent.Image == "http://www.roblox.com/asset/?id="..closeid then -- If close
        script.Parent.Parent.MenuOptions.Visible = false
        script.Parent.Image = "http://www.roblox.com/asset/?id="..openid - Close and set open
    end
end)

Please help, Thanks, Blxefirx/Blue

2 answers

Log in to vote
0
Answered by 4 years ago

I'm very silly but, i think you need to have,

script.Parent.Image = "http://www.roblox.com/asset/?id=" ..openid 

I'm pretty sure you need a space.

0
actually in lua it does not matter if you have space or not, you can write script.                                              Parent and it will work :) imKirda 4491 — 4y
Ad
Log in to vote
0
Answered by
imKirda 4491 Moderation Voter Community Moderator
4 years ago

Well first check if the image is not blank and second is that to set image you use this:

script.Parent.Image = "rbxassetid://"..openid

done.

0
I'll give it a try! Blxefirx 31 — 4y

Answer this question