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

Mouser Over Brick Text?

Asked by
A9X 10
9 years ago

I'm trying to make a brick where you hover over the brick and some text appears by your cursor, and if you move the cursor while still on the brick it follows the cursor until you stop hovering over the brick. Thanks to https://scriptinghelpers.org/questions/16904/how-can-i-make-it-when-my-mouse-hovers-over-a-player-a-gui-comes-up-with-there-name this is what I have so far:

local Player = Game.Players.LocalPlayer 
local Mouse = Player:GetMouse()
local aText = "Testing 1, 2, 3..."
Mouse.TargetFilter = nil

Mouse.Move:connect(function() 
    if not Mouse.Target.Parent then return end

    if Mouse.Target and Mouse.Target.Parent == script.Parent then 
        Player.PlayerGui.ScreenGui.SpecialHoverGui.Text = aText
        Player.PlayerGui.ScreenGui.SpecialHoverGui.Visible = true 
    elseif Mouse.Target and Mouse.Target.Parent ~= script.Parent then 
        Player.PlayerGui.ScreenGui.SpecialHoverGui.Visible = false 
    end
end)

However this does not work, could anybody help? Thanks.

0
Where is this script located? Is it in a part? DigitalVeer 1473 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

Hover over the characters and trees in this game, tell me if that's what you need.

0
The game is not active A9X 10 — 9y
Ad
Log in to vote
-1
Answered by 9 years ago

Try putting a click detector inside the brick with the script in it, then using this function:

script.Parent.ClickDetector.MouseHoverEnter:connect(function()
    --code goes here
end)
0
I've already tried this before posting the question, and it is no help. A9X 10 — 9y
0
Where is the local script (If it is inside one, local player only works inside a local script)? Noobegai -4 — 9y

Answer this question