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
 

Frame Follow Mouse

Previous Thread :: Next Thread 
Alexware is not online. Alexware
Joined: 07 May 2010
Total Posts: 661
12 Jun 2015 04:09 PM
I'm trying to get a child frame to follow the user's mouse when they enter a parent frame

Here is the script I have, I tried my best
repeat wait() until game.Players.LocalPlayer:GetMouse() ~= nil
Mouse = game.Players.LocalPlayer:GetMouse()
function onEnter()
if game.Players.LocalPlayer.InteractionInUse.Value == false then
script.Parent.CouchFunctionFrame.Visible = true
game.Players.LocalPlayer.InteractionInUse.Value = true
end
end

function onMove()
if game.Players.LocalPlayer.InteractionInUse == true then
script.Parent.CouchFunctionFrame.Position.X.Offset = Vector3.new(Mouse.X)
print("Works")
script.Parent.CouchFunctionFrame.Position.Y.Offset = Vector3.new(Mouse.Y)
end
end

function onLeave()
if game.Players.LocalPlayer.InteractionInUse.Value == true then
script.Parent.CouchFunctionFrame.Visible = false
game.Players.LocalPlayer.InteractionInUse.Value = false
end
end

script.Parent.MouseEnter:connect(onEnter)
script.Parent.MouseLeave:connect(onLeave)
script.Parent.MouseMoved:connect(onMove)

How can I get it for the child frame(CouchFunctionFrame) to become visible and follow the user's mouse upon entering the parent frame?

Other info: the surfacegui is in the startergui and is adorneed to the item, so yes, localplayer does work... and nothing is showing up in console, so I don't know what I am doing wrong. . .

Alexware
Report Abuse
teseting is not online. teseting
Joined: 15 Sep 2008
Total Posts: 2535
12 Jun 2015 04:39 PM
repeat wait() until game.Players.LocalPlayer:GetMouse() ~= nil
Mouse = game.Players.LocalPlayer:GetMouse()

script.Parent.MouseMoved:connect(function ()

script.Parent.CouchFunctionFrame.Position = UDim2.new(0,Mouse.X,0,Mouse.Y)



end)

function change()

script.Parent.CouchFunctionFrame.Visible = not game.Players.LocalPlayer.InteractionInUse.Value
game.Players.LocalPlayer.InteractionInUse.Value = not game.Players.LocalPlayer.InteractionInUse.Value

end

script.Parent.MouseEnter:connect(change)
script.Parent.MouseLeave:connect(change)

Report Abuse
Alexware is not online. Alexware
Joined: 07 May 2010
Total Posts: 661
12 Jun 2015 04:41 PM
Thanks! The only issue now is that it is offset, I'll try to change it with the ,0, in the x and y
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