12packkid
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1418 |
|
|
| 23 Feb 2013 07:45 AM |
-- This is a localscript that is in a hopperbin, and when I test it, the output says "MouseButton1Click is not a member of PlayerMouse"
g=game.Players.LocalPlayer:GetMouse() p=game.Players.LocalPlayer
g.MouseButton1Click:connect(function(cl) p.Character.Torso.CFrame=cl.Target end)
|
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 23 Feb 2013 07:46 AM |
Exactly what it says. MouseButton1Click is not a valid member (=property / event / method) of mouse.
So...
http://wiki.roblox.com/index.php/Mouse
See if you can find your error :) |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 23 Feb 2013 07:51 AM |
Mouse.MouseButton1Down sounds dumb, thus it'
Mouse.Button1Down |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
| |
|
12packkid
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1418 |
|
|
| 23 Feb 2013 07:54 AM |
--Improved version, but Im still getting errors, and it won't teleport either.
script.Parent.Selected:connect(function(mouse)
g=game.Players.LocalPlayer:GetMouse() p=game.Players.LocalPlayer.Character
g.Button1Down:connect(function(cl) p.Torso.CFrame=cl.Position end) end)
|
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 23 Feb 2013 07:55 AM |
g=game.Players.LocalPlayer:GetMouse() p=game.Players.LocalPlayer.Character
g.Button1Down:connect(function(cl) p.Torso.CFrame=cl.hit end) end)
Please read output. |
|
|
| Report Abuse |
|
|
12packkid
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1418 |
|
|
| 23 Feb 2013 07:56 AM |
The output I got: 13:55:49.995 - Players.Player1.Backpack.Teleport.LocalScript:7: attempt to index local 'cl' (a nil value) 13:55:49.996 - Script "Players.Player1.Backpack.Teleport.LocalScript", Line 7 13:55:49.996 - stack end 13:55:49.999 - Disconnected event because of exception
The script I used:
script.Parent.Selected:connect(function(mouse)
g=game.Players.LocalPlayer:GetMouse() p=game.Players.LocalPlayer.Character
mouse.Button1Down:connect(function(cl) p.Torso.CFrame=cl.Position end) end)
|
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 23 Feb 2013 07:57 AM |
A wait yes, Button1Click doesnt pass on any variables. Use the mouse itself.
(A tip: use normal variable names... This will get you confused when the script get bigger.)
g=game.Players.LocalPlayer:GetMouse() p=game.Players.LocalPlayer.Character
g.Button1Down:connect(function() p.Torso.CFrame = g.hit end) end) |
|
|
| Report Abuse |
|
|
12packkid
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1418 |
|
|
| 23 Feb 2013 07:58 AM |
Now I'm getting the error 'Attempt to index 'cl' nil value'. I used jobro's script. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 23 Feb 2013 07:58 AM |
g=game.Players.LocalPlayer:GetMouse() p=game.Players.LocalPlayer.Character
g.Button1Down:connect(function(cl) p.Torso.CFrame=cl.Position end)
An end too much. |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
| |
|
12packkid
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1418 |
|
|
| 23 Feb 2013 08:00 AM |
| Oh wait, I used Jobro's improved one, and it worked, but it works even when I unequip the tool as well. This is a problem I need fixing as if it is a VIP tool, any player can click anywhere and get teleported. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 23 Feb 2013 08:02 AM |
That's because you use player mouse...
Use the hopperbin one (are you using a hopperbin? Yes? Right?)
p=game.Players.LocalPlayer.Character
local HopperBin = script.Parent
HopperBin.Selected:connect(function(Mouse) Mouse.Button1Down:connect(function() p.Torso.CFrame=Mouse.hit end) end) |
|
|
| Report Abuse |
|
|