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

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

Asked by
chafava -113
4 years ago
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 :(

0
LocalScripts cant run from the workspace Thetacah 712 — 4y

1 answer

Log in to vote
1
Answered by
Thetacah 712 Moderation Voter
4 years ago
Edited 4 years ago

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
0
ty :) chafava -113 — 4y
Ad

Answer this question