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

need help to fix GUI script ?

the script runs before the imagebutton enters slots.. it skips function MouseHover()

local gui = script.Parent
local slots = gui.Frame.ScrollingFrame.FrameH
local hats = slots:GetChildren()
local item = gui.Frame.item

function findfirstchild(slots)
if slots.Name == "a1" then
for i = 1,#hats do
    hats[i].MouseEnter:connect(function()
function MouseHover()
wait()
item.ImageLabel.Image = "http://www.roblox.com/Thumbs/Asset.ashx?format=png&width=420&height=420&assetId="..hats[i].id.Value..""
MouseHover()
end
print("successful")
    end)
end
end
end

1 answer

✓ Accepted answer

All you need to do is get rid of the new function MouseHover except for the item.ImageLabel.Image line, you're trying to call the function inside the function with your script.

In your script it was going like this.

function Msg()
print("Hi")
Msg()
end

--The script is only reading this part.

local gui = script.Parent
local slots = gui.Frame.ScrollingFrame.FrameH
local hats = slots:GetChildren()
local item = gui.Frame.item

function findfirstchild(slots)
	if slots.Name == "a1" then
		for i = 1,#hats do
			hats[i].MouseEnter:connect(function()
				item.ImageLabel.Image = "http://www.roblox.com/Thumbs/Asset.ashx?format=png&width=420&height=420&assetId="..hats[i].id.Value..""
				print("successful")
			end)
		end
	end
end

1 comment

0

i found the problem its working fine i just moved local hats = slots:GetChildren() down to the function

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