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

Why does my image not show when the mouse is over the text button?

first off here's my code

local player = game.Players.LocalPlayer
local cash = player:WaitForChild('leaderstats').Cash
local price = 1500 
local tip = script.Parent.Parent.GunPrice
local picture = script.Parent.Parent.ItemPic

script.Parent.MouseButton1Click:connect(function()
	if cash.Value >= price and not player.Backpack:FindFirstChild('MP40') and not player.Character:FindFirstChild('MP40')then
		game.ReplicatedStorage.MP40:Clone().Parent = player.StarterGear 
		game.ReplicatedStorage.MP40:Clone().Parent = player.Character
		cash.Value = cash.Value - price	
		else if player.StarterGear:FindFirstChild('MP40')then
			tip.Text = 'Already Owned'
			wait(2)
			tip.Text = 'Price: $1500'
		else	
			tip.Text = 'Not Enough Cash'
			wait(2)
			tip.Text = 'Price: $1500'
	
		end	
	end	
end)

script.Parent.MouseEnter:connect(function()
tip.Visible = true	
tip.Text = "Price: $1500"
picture.Image = script.ImageValue.Value
end)

script.Parent.MouseLeave:connect(function()
tip.Text = "Price:"
picture.Image = script.ImageValue.Value
end)

this is a shop gui button script i made and everything works but the picture coming up in the mouse enter function it shows up blank and there are no errors in the output window

i have the asset id in a string value inside the script

2 comments

0

Did you forget to subtract one from the id?

0

no i subtracted one, two and three even and it still shows blank.

1 answer

You set the image to the same thing on MouseEnter and MouseLeave, so it will never change.

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