|
| 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 |
|
|
|
| 19 Oct 2015 01:32 PM |
| Please guys, still working on finding the solution myself. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 19 Oct 2015 02:30 PM |
| Check if there are any errors in the output |
|
|
| Report Abuse |
|
|