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: Erm..

Previous Thread :: Next Thread 
Sylverant is not online. Sylverant
Joined: 11 Aug 2014
Total Posts: 30
30 Jan 2015 01:13 PM
Now, I haven't been on Roblox for some time now, so my scripting skills have degraded to mediocre at best.
I'm expecting the following script to print something when a player's mouse is moved over the named part; however, nothing happens. No error messages, no "printing", nothing. Why is this?



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

Mouse.Move:connect(function()
if Mouse.Target == game.Workspace["Part45"] then
print(Mouse.Target)
else
end
end)
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
30 Jan 2015 01:38 PM
local Mouse = game.Players.LocalPlayer:GetMouse()

Mouse.Move:connect(function()
local target = Mouse.Target
if target == workspace.Part45 then
print(target.Name)
end
end)


Should be a LocalScript
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
30 Jan 2015 01:39 PM
^ is exactly the same, btw add more prints and breakpoints
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
30 Jan 2015 01:44 PM
@parkiet I know, I just cleaned it up a bit and said make it local.
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
30 Jan 2015 01:46 PM
try using the changed event instead of move. then make it take an argument. next put a condition if the changed property is the target.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
30 Jan 2015 01:48 PM
Here's a debug version:

print("Active")
local Mouse = game.Players.LocalPlayer:GetMouse()
print("Mouse Set")

Mouse.Move:connect(function()
print("Moved")
local target = Mouse.Target
print("target Set")
if target == workspace.Part45 then
print("If statement true")
print(target.Name)
print = function() end --So this isn't drowned out by move
end
print("If statement ended")
end)
print("Mouse Move event set")
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
30 Jan 2015 01:53 PM
Dude, I know printing the mouse's target doesn't require that much code. dang...
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
30 Jan 2015 01:54 PM
@Rob

That's a debug version, printing will help us to learn what happened.
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
30 Jan 2015 01:56 PM
Whatever
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
30 Jan 2015 02:00 PM
While I'm at it...

print("Active")
local Mouse = game.Players.LocalPlayer:GetMouse()
print("Mouse Set", Mouse)

Mouse.Move:connect(function()
print("Moved")
local target = Mouse.Target
print("target Set", target, workspace.Part45)
if target == workspace.Part45 then
print("If statement true")
print(target.Name)
print = function() end --So this isn't drowned out by move
end
print("If statement ended")
end)
print("Mouse Move event set")

Will let us monitor the variables...
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