|
| 24 Jul 2012 04:30 PM |
function onEquip(Mouse) Gyro = Instance.new("BodyGyro",game.Players.LocalPlayer.Character.Torso) Gyro.maxTorque = Vector3.new(0,9.0000e+009,0)
-- THIS EVENT DOESN"T FIRE!?
Mouse.Move:connect(function() Gyro.cframe = Mouse.Hit end)
script.Parent = game.Players.LocalPlayer.Character game.Players.LocalPlayer.Character.Tool:Destroy() end
script.Parent.Equipped:connect(onEquip)
while game.Players.LocalPlayer.Character == nil do wait(0.1) end while game.Players.LocalPlayer.Character:FindFirstChild("Torso") == nil do wait(0.1) end
script.Parent.Parent = game.Players.LocalPlayer.Character |
|
|
| Report Abuse |
|
|
| |
|
|
| 24 Jul 2012 06:06 PM |
| Add a few prints around the script to confirm what is working and what's not |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2012 06:27 PM |
I already did.
Mouse.Move:connect(function() Gyro.cframe = Mouse.Hit end)
THIS isn't working. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 24 Jul 2012 09:32 PM |
| The mouse exists, but its events don't fire? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
dirk29
|
  |
| Joined: 26 May 2010 |
| Total Posts: 1142 |
|
|
| 24 Jul 2012 10:07 PM |
| Maybe Mouse.hit.Position? I don't use the mouse very often. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2012 10:16 PM |
| It's not the function that's the problem, it's fact that event won't fire! |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2012 10:25 PM |
Try
Gyro.cframe = Mouse.Hit.p
or
Gyro.cframe = Mouse.Hit.CFrame --might need to change that to 'cframe'.
--TehChikenHater ლ(ಠ_ಠლ) |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2012 10:27 PM |
The problem isn't your function. Nothing is generating an error, your just doing it wrong. Mouse.Hit isn't what you need, as I said above, use Mouse.Hit.p, or Mouse.Hit.CFrame/cframe. I don't use Mouse a whole lot, but I know enough to tell you that you are, in fact, doing it wrong. I blame John personally.
--TehChikenHater ლ(ಠ_ಠლ) |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2012 10:37 PM |
| Yes, I know, but when I tested the function with print statements, the event never fired. -_- |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 24 Jul 2012 10:41 PM |
| Well, you can't exactly define a CFrame with a part. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2012 11:05 PM |
Well, I cleaned up the code. It works a bit better now, but there's only one problem: The event will fire a few times, but will eventually halt altogether?
local Tool = Instance.new("Tool")
local Handle = Instance.new("Part",Tool) Handle.Name = "Handle" Handle.Transparency = 1
Tool.Equipped:connect(function(Mouse) Tool.Parent = nil local Gyro = Instance.new("BodyGyro",game.Players.LocalPlayer.Character.Torso) Gyro.maxTorque = Vector3.new(0,math.huge,0) Mouse.Move:connect(function() print("Moved") Gyro.cframe = Mouse.Hit end) end)
Tool.Parent = game.Players.LocalPlayer.Character |
|
|
| Report Abuse |
|
|
| |
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 24 Jul 2012 11:50 PM |
Again.... How The **** Would You Define a cframe with an instance? |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2012 11:52 PM |
| The 'Hit' property of the mouse IS a CFrame value. |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 24 Jul 2012 11:53 PM |
q_q..... I am ashamed... Sorry :(
|
|
|
| Report Abuse |
|
|
|
| 24 Jul 2012 11:55 PM |
| Bah, I just need to get this event working! Any advice? |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 24 Jul 2012 11:59 PM |
ummm.... Don't use anonymous functions? They annoy me q.q |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2012 09:35 AM |
| They take up less memory. =3 |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2012 09:44 AM |
local Tool = Instance.new("Tool")
local Handle = Instance.new("Part",Tool) Handle.Name = "Handle" Handle.Transparency = 1
Tool.Equipped:connect(function(Mouse) Tool.Parent = nil local Gyro = Instance.new("BodyGyro",game.Players.LocalPlayer.Character.Torso) Gyro.maxTorque = Vector3.new(0,math.huge,0) Mouse.Move:connect(function() print("Moved") Gyro.cframe = Mouse.Hit end) end)
Tool.Parent = game.Players.LocalPlayer.Character <<<<<< Why is that at the end?? |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2012 09:48 AM |
| One more thing. How about you try it without removing the tool? |
|
|
| Report Abuse |
|
|