generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Mousing over your own character?

Previous Thread :: Next Thread 
Seranok is not online. Seranok
Joined: 12 Dec 2009
Total Posts: 11083
18 Oct 2012 11:18 AM
I want to make it so when someone mouses over their own character, GUIs appear, but I don't know what is the best for this. I don't want to rely on them equipping a tool or anything.
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
18 Oct 2012 11:22 AM
Possibly check if character is in cameras view, to make sure you're zoomed out, and check if they hoover mouse over middle of screen.
Report Abuse
Seranok is not online. Seranok
Joined: 12 Dec 2009
Total Posts: 11083
18 Oct 2012 11:23 AM
But what method do I use? getmouse?
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
18 Oct 2012 11:34 AM
Well if you don't want to use tools, i guess GUI's, but i haven't been on roblox for really quiet a while, so idk if you can get mouse without tools already.
Report Abuse
Maelstronomer is not online. Maelstronomer
Joined: 07 Jun 2008
Total Posts: 7649
18 Oct 2012 11:39 AM
Add an invisible flat part that faces your camera at all times, that's stuck on your character but offsetted a bit between your character and the camera's location. Use magnitude yo.

Option B, use a GUI in the middle of the screen, BUT resize the GUI based on how close the camera is to the character so it's correctly proportioned. Magnitude again. :D
Report Abuse
belial52 is not online. belial52
Joined: 10 Oct 2009
Total Posts: 8074
18 Oct 2012 11:44 AM
local mouse = game.Players.Player:GetMouse()

Just check to see if they mouse over any part of their own body and if so then make the guis appear. You can use mouse.Target to see if the part is one of their body parts.
Report Abuse
Maelstronomer is not online. Maelstronomer
Joined: 07 Jun 2008
Total Posts: 7649
18 Oct 2012 11:50 AM
Oh that works? I thought it wouldn't because the character's locked. If it does work, that's so much easier.
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
18 Oct 2012 11:51 AM
Mouse ignores your character.
Report Abuse
woot3 is not online. woot3
Joined: 10 Nov 2008
Total Posts: 3599
18 Oct 2012 12:05 PM
Picking up on what Maelstronomer said, I'd place a part right through your character, welded to the torso (weightless of course) and parent it to your camera (I believe that should work, maybe some weird issues so if not Workspace will work) and then just check when it's the mouse's target.
Report Abuse
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
18 Oct 2012 12:08 PM
Yeah, you may get the best (ie, most accurate) results if you weld a transparent, CanCollide=false part to every part of the player's body. Then parent those parts to workspace, and you're able to click on them.

However, that might prove really annoying. For the player, that is.

In fact, this entire "gui when you mouse over your character" might be really annoying. People swipe their mouse over the character all the time. They'll just see flickering Guis every couple of seconds.
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
18 Oct 2012 12:37 PM
Make it only appear after a couple of seconds of hovering over.
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
18 Oct 2012 12:46 PM
1) Use an invisible part
2) Use a ClickDetector(might not work?)
3) Use raycasting
Report Abuse
Droban is not online. Droban
Joined: 12 Aug 2012
Total Posts: 157
18 Oct 2012 03:26 PM
I was thinking of popin's last suggestion. Doesn't the mouse have a ray property or something? Use that with FindPartOnRay to see if the mouse is over the character, since the mouse normally (and should) ignore the character.
Report Abuse
jewelycat is not online. jewelycat
Joined: 10 Sep 2008
Total Posts: 17345
18 Oct 2012 05:20 PM
I think there's a Ray property of mouse, use that and raycast from it?
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
18 Oct 2012 06:25 PM
NOOOOOOOOOOOOOOOBS!!!

Noobs everywhere!


mouse = player:GetMouse()
mouse.TargetFilter = nil
mouse.Move:connect(function()
local part = mouse.Target
local owner = game.Players:GetPlayerFromCharacter(part.Parent) or game.Players:GetPlayerFromCharacter(part.Parent.Parent)
if owner == player then
-- mouse over player
end
end)

This should be the fix to your problem. Now shower me with money.
Report Abuse
jewelycat is not online. jewelycat
Joined: 10 Sep 2008
Total Posts: 17345
18 Oct 2012 06:32 PM
@Arceus, Even with nil TargetFilter, it still ignores character?
Report Abuse
NinjaShadow1 is not online. NinjaShadow1
Joined: 03 Mar 2009
Total Posts: 2689
18 Oct 2012 06:46 PM
Can't you do some ugly hax using mouse.hit.p?
Report Abuse
xSIXx is not online. xSIXx
Joined: 06 Aug 2010
Total Posts: 9202
18 Oct 2012 06:47 PM
@arc

i that still ignores your character.

just raycast from Camera.CoordinateFrame.p to mouse.Hit.p and see if the character is detected.
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
18 Oct 2012 06:58 PM
"i that still ignores your character."

You sure? I'm pretty sure it didn't do that before. Anyway, it's an easy fix.


mouse = player:GetMouse()
mouse.TargetFilter = nil
mouse.Move:connect(function()
local part = workspace:FindPartOnRay(mouse.UnitRay, {}, true)
local owner = game.Players:GetPlayerFromCharacter(part.Parent) or game.Players:GetPlayerFromCharacter(part.Parent.Parent)
if owner == player then
-- mouse over player
end
end)

I've never successfully done raycasting, though. So you might need to tweak that.
Report Abuse
xSIXx is not online. xSIXx
Joined: 06 Aug 2010
Total Posts: 9202
18 Oct 2012 07:03 PM
@arc

what.

that's the args for :FindPartOnRayWithIgnoreList()

noooooooooooooooob.
Report Abuse
belial52 is not online. belial52
Joined: 10 Oct 2009
Total Posts: 8074
18 Oct 2012 07:07 PM
Pretty sure the mouse doesn't ignore the character if you target it directly anyways...
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
18 Oct 2012 08:00 PM
Raycasts work fine.

Report Abuse
CryHard is not online. CryHard
Joined: 07 Oct 2012
Total Posts: 239
18 Oct 2012 08:54 PM
I made something similar to some of the people's scripts.


    local LocalPlayer = game:service("Players").LocalPlayer
    local Mouse = LocalPlayer:GetMouse()
    --
    pcall(function()LocalPlayer.PlayerGui.main:Destroy() LocalPlayer.LocalScript:Destroy() end)
    get = {}
    get.PlayerGui = LocalPlayer:findFirstChild("PlayerGui")
    --
    local MainGui = Instance.new("ScreenGui",get.PlayerGui)
    MainGui.Name = "main"
    local MainFrame = Instance.new("Frame",MainGui)
    MainFrame.Name = "mainFrame"
    MainFrame.Size = UDim2.new(1,0,1)
    MainFrame.BackgroundTransparency = 1
    local Aim = Instance.new("Part")
    Aim.Anchored = true
    Aim.Transparency = 1
    local Billboard = Instance.new("BillboardGui",Aim)
    Billboard.Adornee = Aim
    Billboard.Size = UDim2.new(4,0,1,0)
    Billboard.StudsOffset = Vector3.new(0,3,0)
    local Frame = Instance.new("Frame",Billboard)
    Frame.Size = UDim2.new(1,0,1,0)
    Frame.BackgroundTransparency = 1
    local Name = Instance.new("TextLabel",Frame)
    Name.Size = UDim2.new(1,0,1,0)
    Name.Font = "ArialBold"
    Name.BackgroundTransparency = 1
    Name.FontSize = "Size14"
    Name.TextScaled = true
    Mouse.Move:connect(function()
        pcall(function()
        local Target = Mouse.Target
            if Target:IsA("Part") or Target.Name == "Handle" then
                if game:service("Players"):GetPlayerFromCharacter(Target.Parent) then
                    local Player = game:service("Players"):GetPlayerFromCharacter(Target.Parent)
                    Name.Text = Player.Name
                    Aim.Parent = workspace.CurrentCamera
                    Aim.CFrame = Player.Character.Head.CFrame
                else
                    Aim.Parent = nil
                end
            end
        end)
    end)

This just shows the name of the player
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
19 Oct 2012 01:00 AM
That's going to be a lot of work to fine-tune.

The mouse is over your character far more than you realize in normal play, so you'll have to tune the thing a lot to make it "feel" good and not bring it up a lot when you didn't want it.

As for the technical side, definitely use raycasting + GetMouse() to do it.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
19 Oct 2012 06:50 AM
You can always use ClickDetectors, can you not?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image