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

Why won't hovering over object work? (reupload)

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

while true do
if mouse.Target == script.Parent.Parent.Parent then
    print("Mouse hovering over food")
    script.Parent.BillboardGui.Enabled = true
else
    script.Parent.BillboardGui.Enabled = false
end
wait(.1)
end

reupload because no one answered me last time properly :(

1 comment

0

LocalScripts cant run from the workspace

1 answer

✓ Accepted answer

LocalScripts cannot be run from the Workspace. v

A LocalScript will only run Lua code if it is a descendant of one of the following objects: A Player’s Backpack, such as a child of a Tool A Player’s character model A Player’s PlayerGui A Player’s PlayerScripts. The ReplicatedFirst service

What you should do(insert this LocalScript in "StarterPack"):

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local part = game.Workspace.Food--Change this variable to the food part
local billboard = part.BillboardGui --Change this variable to the billboardgui

while true do
	if mouse.Target == part then
    		billboard.Enabled = true

	    print("Mouse hovering over food")
	else
   		 billboard.Enabled = true

	end

	wait(.1)
end

1 comment

0

ty :)

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