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

error with gui local script ?

Asked by 10 years ago

OUTPUT:01:15:43.903 - Attempt to connect failed: Passed value is not a function 01:15:43.908 - Script 'Players.Player.PlayerGui.ScreenGui.test', Line 35 01:15:43.909 - Stack End 01:15:43.909 - Players.Player.PlayerGui.ScreenGui.test:36: attempt to call global 'MouseHover' (a nil value) 01:15:43.912 - Stack Begin 01:15:43.914 - Script 'Players.Player.PlayerGui.ScreenGui.test', Line 36 01:15:43.914 - Stack End 01:15:50.275 - attempt to call a nil value 01:15:50.278 - Disconnected event because of exception

 local gui = script.Parent
local item = gui.Configuration
local slots = gui.Frame.ScrollingFrame.FrameI

local P = game.Players.LocalPlayer;
repeat wait() until P.Character;
local C = P.Character;
local hats = slots:GetChildren()
for i = 1,#hats do

function MouseHover()
    hats[i].MouseEnter:connect(function()
wait()
item.hat.Text = "http://www.roblox.com/Thumbs/Asset.ashx?format=png&width=420&height=420&assetId="..hats[i].id.Value..""
item.Title.Text = hats[i].TextLabel.Text
item.id.Value = hats[i].id.Value
end
MouseHover()
print("successful")
    end)
end


function list()
    gui.Frame.item.id.Text = item.id.Value
    gui.Frame.item.Title.Text = item.Title.Text
    gui.Frame.item.ImageLabel.Image = item.hat.Text
end

for i = 1,#hats do
    hats[i].MouseButton1Up:connect(function()
list()
    end)
end
slots.ChildAdded:connect( MouseHover )
MouseHover()

script works fine when everything is loaded but this is an inventory so when i buy a hat it goes to the inventory but cant click it and mousehover isnt working... the hat i hover over on other tab works with same script

1 answer

Log in to vote
1
Answered by 10 years ago

I believe I fixed it. But I don't know without seeing the GUI and testing it.

local gui = script.Parent
local item = gui.Configuration
local slots = gui.Frame.ScrollingFrame.FrameI

local P = game.Players.LocalPlayer;
repeat wait() until P.Character;
    local C = P.Character;
    local hats = slots:GetChildren()
    for i = 1,#hats do
        function MouseHover()
                hats[i].MouseEnter:connect(function()
                wait()
                item.hat.Text = "http://www.roblox.com/Thumbs/Asset.ashx?format=png&width=420&height=420&assetId="..hats[i].id.Value..""
                item.Title.Text = hats[i].TextLabel.Text
                item.id.Value = hats[i].id.Value
            end)
        end
        MouseHover()
        print("successful")
end

function list()
    gui.Frame.item.id.Text = item.id.Value
    gui.Frame.item.Title.Text = item.Title.Text
    gui.Frame.item.ImageLabel.Image = item.hat.Text
end

for i = 1,#hats do
    hats[i].MouseButton1Up:connect(function()
        list()
    end)
end
slots.ChildAdded:connect(MouseHover)
MouseHover()
0
still says same output bcuz when script runs there in nothing in the frame once i buy the hat then a button goes into the frame Layfonex 0 — 10y
0
had to create childadded function to refresh the script Layfonex 0 — 10y
0
Did that fix it? MrLonely1221 701 — 10y
Ad

Answer this question