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 » Scripting Helpers
Home Search
 

Re: should i use mouse.Target or mouse.Hit on this?

Previous Thread :: Next Thread 
noah is online. noah
Joined: 11 Sep 2006
Total Posts: 18977
11 Jan 2013 05:25 PM
i honestly have no clue

elseif modes[mnum] == "Lasor" then
SPL = Instance.new("SelectionPartLasso")
SPL.Parent = me.Character:findFirstChild("Right Arm")
--repeat wait() until mouse.Target:IsA("Part")
SPL.Humanoid = mouse.Target -- DIS PART
SPL.Color = BrickColor.new(0, 35, 0)
SPL.Part = me.Character:findFirstChild("Right Arm")
wait(3)
SPL:Destroy()
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
11 Jan 2013 05:27 PM
mouse.Hit is a CFrame
mouse.Target is a part

So yes, Target. Specifically mouse.Target.Parent.Humanoid (might want to check tahts a valid part)
Report Abuse
noah is online. noah
Joined: 11 Sep 2006
Total Posts: 18977
11 Jan 2013 05:28 PM
hmmm, it breaks the script tho
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
11 Jan 2013 05:32 PM
"repeat wait() until mouse.Target:IsA("Part")
SPL.Humanoid = mouse.Target"

Of course it breaks. If the target is a Part, then how can you set it as the SelectionPartLasso's humanoid...?

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
noah is online. noah
Joined: 11 Sep 2006
Total Posts: 18977
11 Jan 2013 05:36 PM
k updated but it still nu wurky

SPL = Instance.new("SelectionPartLasso")
SPL.Parent = me.Character:findFirstChild("Right Arm")
--repeat wait() until mouse.Target:IsA("Part")
SPL.Humanoid = mouse.Target:findFirstChild("Humanoid")
SPL.Color = BrickColor.new(0, 35, 0)
SPL.Part = me.Character:findFirstChild("Right Arm")
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
11 Jan 2013 05:39 PM
First of all, you're still commenting the repeat loop line. Second, if your mouse is hovering over a part that doesn't have a humanoid in it, it will break. The SelectionPartLasso's Humanoid property will be set to nil and everything following it will break.

SPL = Instance.new("SelectionPartLasso")
SPL.Parent = me.Character:findFirstChild("Right Arm")
repeat wait() until mouse.Target:IsA("Part") and mouse.Target:FindFirstChild("Humanoid")
SPL.Humanoid = mouse.Target:findFirstChild("Humanoid")
SPL.Color = BrickColor.new(0, 35, 0)
SPL.Part = me.Character:findFirstChild("Right Arm")


http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
noah is online. noah
Joined: 11 Sep 2006
Total Posts: 18977
11 Jan 2013 05:48 PM
Yea, I know the repeat line is a comment. >_> You're code doesn't break the script, but it doesn't do anything either.
Report Abuse
noah is online. noah
Joined: 11 Sep 2006
Total Posts: 18977
11 Jan 2013 05:49 PM
Your* curse yu gramer
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
11 Jan 2013 05:50 PM
Well then you're obviously not hovering over a brick with a Humanoid in it. :P

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
noah is online. noah
Joined: 11 Sep 2006
Total Posts: 18977
11 Jan 2013 05:51 PM
I'm not trying to click on a brick. I want to insert a selectionpartlasso from my right arm to a players' character's part.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
11 Jan 2013 05:53 PM
Well dude... Characters' parts don't contain Humanoids... The Characters themselves do.

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
11 Jan 2013 05:56 PM
Frankly, I don't like the repeat loop here. Screws everything up and just over-complicates things.

while wait() do
if mouse.Target:IsA("Part") then
if mouse.Target.Parent:FindFirstChild("Humanoid") then
SPL = Instance.new("SelectionPartLasso")
SPL.Parent = me.Character:findFirstChild("Right Arm")
SPL.Humanoid = mouse.Target.Parent:findFirstChild("Humanoid")
SPL.Color = BrickColor.new(0, 35, 0)
SPL.Part = me.Character:findFirstChild("Right Arm")
local targ = mouse.Target
Spawn(function()
repeat wait() until mouse.Target ~= targ
SPL:destroy()
end)
end
end


http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
11 Jan 2013 05:57 PM
Wait, needs another end.

while wait() do
if mouse.Target:IsA("Part") then
if mouse.Target.Parent:FindFirstChild("Humanoid") then
SPL = Instance.new("SelectionPartLasso")
SPL.Parent = me.Character:findFirstChild("Right Arm")
SPL.Humanoid = mouse.Target.Parent:findFirstChild("Humanoid")
SPL.Color = BrickColor.new(0, 35, 0)
SPL.Part = me.Character:findFirstChild("Right Arm")
local targ = mouse.Target
Spawn(function()
repeat wait() until mouse.Target ~= targ
SPL:destroy()
end)
end
end
end

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
noah is online. noah
Joined: 11 Sep 2006
Total Posts: 18977
12 Jan 2013 12:20 AM
Just tried it and it doesn't work. I'm going to cry now, kthx.
Report Abuse
kholech is not online. kholech
Joined: 18 Dec 2009
Total Posts: 1135
12 Jan 2013 02:50 AM
At least recognize he's helping you.

~The local Lumberjack.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
12 Jan 2013 06:21 PM
Have you even defined mouse...?

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
12 Jan 2013 06:22 PM
Because if you're using what I posted without something prior to it, then there's a very obvious reason why it's not working...

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
noah is online. noah
Joined: 11 Sep 2006
Total Posts: 18977
12 Jan 2013 06:39 PM
Mouse is defined. Don't take me as a fool, please. I appreciate your help even though it's not working.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
12 Jan 2013 07:34 PM
Alright, I tested this. It works, but I have to go and don't have time to make it delete the SelectionPartLassos after you stop hovering over the player. If you can't figure it out, I'll help you later. Note that this MUST be a LocalScript and it should go in StarterPack. The GetMouse method only works in LocalScripts.

wait(2)
repeat wait() until game.Players.LocalPlayer
local p = game.Players.LocalPlayer
local mouse = p:GetMouse()

mouse.Move:connect(function()
if mouse.Target then
if mouse.Target:IsA("BasePart") then
if mouse.Target.Parent:FindFirstChild("Humanoid") then
local SPL = Instance.new("SelectionPartLasso")
SPL.Parent = p.Character:FindFirstChild("Right Arm")
SPL.Humanoid = mouse.Target.Parent:FindFirstChild("Humanoid")
SPL.Color = BrickColor.new(0, 35, 0)
SPL.Part = p.Character:FindFirstChild("Right Arm")
end
end
end
end)



http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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