so im making a script where if a button is clicked image is changing
this is the script:
local aa = script.Parent
local Image = script.Parent.Image
local Audio = script.Parent.Song
script.Parent.MouseButton1Click:connect(function()
if
Audio.Playing = true
Image = "image id one"
else
Audio.Playing = false
Image = "image id two"
end
end)
local aa = script.Parent
local Image = script.Parent.Image
local Audio = script.Parent.Song
script.Parent.MouseButton1Click:connect(function()
if
Audio.Playing == true then
Image.ImageID = 112902314
else
Audio.Playing = false
Image.ImageID = 73737626
end
end)
firstly, i have no clue why you would be setting the audio playing to false when you already verified that it isnt playing
further, could you try adding prints inside both variations? and do you have any errors in output?
local aa = script.Parent
local Image = script.Parent.Image
local Audio = script.Parent.Song
script.Parent.MouseButton1Click:connect(function()
if Audio.Playing == true then -- Check if audio is playing
Image.ImageID = 112902314
else -- If audio is not playing then change image to something else
Image.ImageID = 73737626
end
end)
local button = script.Parent
local Audio = script.Parent.Song
button.MouseButton1Click:connect(function()
if not Audio.Playing then -- or: if Audio.Playing == false then
Audio.Playing = true
button.Image = "rbxassetid://112902314"
else
Audio.Playing = false
button.Image = "rbxassetid://73737626"
end
end)