Is there another form of Mouse.Target so a Model can be targeted?

Hello All,

I’m attempting to use mouse.Target to have the name of an object pop up when a mouse hovers over the object. Each object has a stingValue named “Mineral”. This works fine if the object is a BasePart. It doesn’t work when the object is a Model. Is there a similar function to get the same effect when hovering over a Model? I’ve searched a bit, but so far in vain. The example script is below:

UIS.InputChanged:Connect(function(input)
	if mouse.Target then
		if mouse.Target:FindFirstChild("Mineral") then
			player.PlayerGui.BillboardGui.Enabled = true
			player.PlayerGui.BillboardGui.Adornee = mouse.Target
			player.PlayerGui.BillboardGui.TextLabel.Text = mouse.Target.Name
		else
			player.PlayerGui.BillboardGui.Enabled = false
			player.PlayerGui.BillboardGui.Adornee = nil
			player.PlayerGui.BillboardGui.TextLabel.Text = ""
		end
	end
end)
1 Like

What you have to do is search for a model that is parented to the Mineral.

2 Likes

Oh man, that was too easy. I did what you said. I made a part, slightly larger than the model, made it transparent, then put the model inside of the part. It’s working great! Thanks for the insight!

1 Like