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

When Player Hovers Mouse over another Character, a GUI Appears?

Asked by
Borrahh 265 Moderation Voter
4 years ago

Basically, There is a Billboard Gui on player's head, but ive set it To invisible, so only when players hover their mouse, it should appear, but i get this error: Character is not a valid member of Model

local Mouse = game.Players.LocalPlayer:GetMouse()

while wait() do
    if Mouse.Target and Mouse.Target.Parent:IsA("Model") and game.Players:GetPlayerFromCharacter(Mouse.Target.Parent) then
        print("hi")
        Mouse.Target.Parent.Character.Head.BillboardGui.Enabled = true
    end
end

0
You tried to get the Character inside the Character in line 6 User#34929 0 — 4y
0
Don't use a for loop, use a MouseMove event. ACHRONlX 255 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

You tried to get the Character inside the Character in line 6. You already have the Character when writing" Mouse.Target.Parent", so remove Character in line 6.

0
Now i get the error: BillboardGui is not a valid member of Part Borrahh 265 — 4y
Ad
Log in to vote
0
Answered by
haba_nero 386 Moderation Voter
4 years ago
local Mouse = game.Players.LocalPlayer:GetMouse()

while wait() do
    if Mouse.Target and Mouse.Target.Parent:IsA("Model") and game.Players:GetPlayerFromCharacter(Mouse.Target) then
    local Player = game.Players:GetPlayerFromCharacter(Mouse.Target)
        print("hi")
        Player.Character.Head.BillboardGui.Enabled = true
    end
end

Maybe this will work. I defined a variable called "Player" and changed Mouse.Target.Parent to Mouse.Target because the target is the entire model.

0
then why exactly did u still do "Mouse.Target.Parent:IsA("Model")" im confused TNTIsLyfe 152 — 4y
0
oh sorry. I didn't read the whole thing. Silly me! You can delete the parent haba_nero 386 — 4y

Answer this question