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: I found an old script that follows your mouse but there's an error..

Previous Thread :: Next Thread 
ADULTSWlM is not online. ADULTSWlM
Joined: 25 Jul 2011
Total Posts: 465
23 Aug 2011 04:51 PM
Here it is:
bin = script.Parent
Tool = script.Parent;
function getjoint()
player = bin.Parent
char = player
if char ~= nil then
torso = char:FindFirstChild("Torso")
if torso~= nil then
joint = torso:FindFirstChild("Right Shoulder")
if joint~=nil then
return joint
end
end
end
return nil
end

function getarm()
player = bin.Parent
char = player
if torso~= nil then
arm = char:FindFirstChild("Right Arm")
if arm~=nil then
return arm
end
end
return nil
end

function pointarmto(t, a, p, c0, c1)
mid = (t.CFrame*CFrame.new(c0)).p --offset position
dir = (mid - p).unit
rot = CFrame.fromEulerAnglesXYZ(math.pi/2, 0, 0)
rightangle = CFrame.fromEulerAnglesXYZ(0, 0, math.pi)
off = CFrame.new(c1)
a.CFrame = CFrame.new(mid, mid+dir)*rot*off*rightangle
end

function Bob(mouse)
while sel do
wait(0.01)
joint = getjoint()
local c0 = nil
local c1 = nil
if joint~= nil then
c0 = joint.C0.p -- center of arm
c1 = joint.C1.p
arm = getarm()
arm.Anchored = true
torso = joint.Part0
joint.Part1 = nil -- detach arm
pointing = true
point = mouse.Hit.p
pointarmto(torso, arm, point, c0, c1)
end
end
end


function FreddyBobson(mouse)
sel = true
Bob(mouse)
end

script.Parent.Equipped:connect(FreddyBobson)
sel = true
Bob()

function Desel(mouse)
joint = getjoint()
arm = getarm()
joint.Part1 = arm
arm.Anchored = false
sel = false
end

script.Parent.Deequipped:connect(Desel)


And the output says that Line 53 was attempting a local 'mouse' (a nil value) or where you see "point=mouse.Hit.p"

Can you fix it?





Report Abuse
stuntkid257 is not online. stuntkid257
Joined: 12 Jul 2010
Total Posts: 1394
23 Aug 2011 04:53 PM
Where's line 53? 0.o
Report Abuse
ADULTSWlM is not online. ADULTSWlM
Joined: 25 Jul 2011
Total Posts: 465
23 Aug 2011 04:55 PM
Just find the part that says "point=mouse.Hit.p"
Report Abuse
ADULTSWlM is not online. ADULTSWlM
Joined: 25 Jul 2011
Total Posts: 465
23 Aug 2011 04:58 PM
omg halp.
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
23 Aug 2011 04:59 PM
I'm not fixing free models.
Report Abuse
ADULTSWlM is not online. ADULTSWlM
Joined: 25 Jul 2011
Total Posts: 465
23 Aug 2011 05:00 PM
So? At least help me of what's the problem with this free modeled script?
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