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

how to make the text label pop an image up when the mouse is hovering over it?

Asked by 6 years ago

I was wonder how to make this script work because when i hover over the button everything else works but the image label... heres the code that i use if you see any errors in it please tell me and help me correct it. i know theres errors.

local player = game.Players.LocalPlayer
local GravityCoil = "1592513575"
local currency = player:WaitForChild('leaderstats').Coins
local amount = 100
local tool = game.ServerStorage:WaitForChild('GravityCoil')
local indextext = script.Parent.Text

script.Parent.MouseButton1Click:connect(function()
    if currency.Value >=100 and not player.Backpack:FindFirstChild('GravityCoil')or player.Character:FindFirstChild('GravityCoil')then

        currency.Value = currency.Value - amount
        local newtool = tool:Clone()
        newtool.Parent = player.Backpack
    else
        script.Parent.Text = "Purchase Failed, Try again later"
        wait(0.5)
        script.Parent.Text = indextext
    end
end)

script.Parent.MouseEnter:connect(function()
    script.Parent.Parent.Parent.productimage.Image = 'rbxassetid://'..GravityCoil
    script.Parent.Parent.Parent.Description.Text = script.descvalue.Value
    script.Parent.Parent.Parent.ProductTitle.Text = script.TitleValue.Value
end)
script.Parent.MouseEnter:connect(function()
    script.Parent.Parent.Parent.productimage.Image = GravityCoil
    script.Parent.Parent.Parent.Description.Text = ""
    script.Parent.Parent.Parent.ProductTitle.Text =""

end)

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Dear 410200cold2, The way i've always done it is insted of using your mouse enter you simply use script.Parent.MouseHover:connect(function()

script.Parent.OnMouseHover:connect(function()
Ad

Answer this question