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: Mouse Trouble

Previous Thread :: Next Thread 
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
19 Oct 2015 01:27 PM
This code keeps printing 'No Target' in the output, it will not destroy the target if it is the correct one
either.

player = game.Players.LocalPlayer
mouse = player:GetMouse()
mouse.Move:connect(function()
if mouse.Target then
if mouse.Target.Name == "Small" or mouse.Target.Name == "Medium" or mouse.Target.Name == "Large" then
box = Instance.new("SelectionBox", mouse.Target)
box.Adornee = mouse.Target
wait(3)
box:Destroy()
else
print("No Target")
end
end
end)
mouse.Button1Down:connect(function()
if mouse.Target:IsA("Model") then
if mouse.Target.Name == "Small" then
experience = 10
smalltree = mouse.Target
smalltree:Destroy()
player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value = player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value + experience
elseif mouse.Target.Name == "Medium" then
experience2 = 20
mediumtree = mouse.Target
mediumtree:Destroy()
player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value = player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value + experience2
elseif mouse.Target.Name == "Large" then
experience3 = 30
largetree = mouse.Target
largetree:Destroy()
player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value = player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value + experience3
end
end
end)
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
19 Oct 2015 01:32 PM
Please guys, still working on finding the solution myself.
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
19 Oct 2015 01:38 PM
I have created a new code for it, the only problem in this one is;
It will not read the magnitude of the target and the torso.

player = game.Players.LocalPlayer
mouse = player:GetMouse()
mouse.Move:connect(function()
if mouse.Target then
if mouse.Target.Parent.Name == "Small" or mouse.Target.Parent.Name == "Medium" or mouse.Target.Parent.Name == "Large" then
if (mouse.Target.Position - player.Character.Torso.Position).magnitude <= 3 then
box = Instance.new("SelectionBox", mouse.Target)
box.Adornee = mouse.Target
game.Debris:AddItem(box, 3)
else
print("No Target")
end
end
end
end)
mouse.Button1Down:connect(function()
if mouse.Target:IsA("Model") then
if mouse.Target.Parent.Name == "Small" then
experience = 10
smalltree = mouse.Target
smalltree:Destroy()
player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value = player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value + experience
elseif mouse.Target.Parent.Name == "Medium" then
experience2 = 20
mediumtree = mouse.Target
mediumtree:Destroy()
player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value = player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value + experience2
elseif mouse.Target.Parent.Name == "Large" then
experience3 = 30
largetree = mouse.Target
largetree:Destroy()
player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value = player.PlayerGui.GameInterface.UserInput.Experience.Exp.Value + experience3
end
end
end)
Report Abuse
ByteInfinity is not online. ByteInfinity
Joined: 07 Jun 2014
Total Posts: 459
19 Oct 2015 02:30 PM
Check if there are any errors in the output
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