Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
|
| 06 Dec 2013 10:56 AM |
I'm having some problems constantly moving a brick to the mouse location. I tried using:
while true do h.Position = Vector3.new(mouse.Target) end
The brick stays in its exact location as it was before.
Full script (this is a hopperbin):
function onSelected(mouse) local h = Instance.new("Part", Workspace) h.Color = Color3.new(1, 1, 1) h.CanCollide = false h.Rotation = Vector3.new(0, 0, 0.1) h.Size = Vector3.new(3, 1.2, 3) h.Position = Vector3.new(mouse.Target) while true do wait() h:Destroy() wait() local h = Instance.new("Part", Workspace) h.Color = Color3.new(1, 1, 1) h.CanCollide = false h.Rotation = Vector3.new(0, 0, 0.1) h.Size = Vector3.new(3, 1.2, 3) while true do wait() h.Position = Vector3.new(mouse.Target) end end end
script.Parent.Selected:connect(onSelected) script.Parent.Deselected:connect(function() h:Remove() end)
There is no error output. |
|
|
| Report Abuse |
|
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
| |
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
| |
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
| |
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
|
| 06 Dec 2013 11:25 AM |
Thank you. Hvala ti, mnogo. Zakljucao sam da si ili hrvat ili srbin po imenu. |
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 06 Dec 2013 11:26 AM |
| No problem! Croatia indeed. |
|
|
| Report Abuse |
|
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
|
| 06 Dec 2013 11:30 AM |
| Still doesn't work, it says that I'm trying to index Target, a nil value. |
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 06 Dec 2013 11:34 AM |
Try using this.
CFrame = CFrame.new(mouse.Target.p) |
|
|
| Report Abuse |
|
|
|
| 06 Dec 2013 11:36 AM |
Or Perhaps Mouse.Hit.p?
Maybe you posted something about how you don't want to be able to do it anywhere. |
|
|
| Report Abuse |
|
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
|
| 06 Dec 2013 11:39 AM |
Still same output. I want to fix this so badly. |
|
|
| Report Abuse |
|
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
|
| 06 Dec 2013 11:41 AM |
@dog
I used Hit.p It moves the brick to where the mouse is, but after its moved it starts moving upwards and forward.
Is there any way if I can check if the mouse moved and then move the brick? |
|
|
| Report Abuse |
|
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
| |
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
| |
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
|
| 07 Dec 2013 12:50 AM |
bump [5]
i am getting tired |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 07 Dec 2013 12:58 AM |
function onSelected(mouse) h = Instance.new("Part", Workspace) h.Color = Color3.new(1, 1, 1) h.CanCollide = false h.Rotation = Vector3.new(0, 0, 0.1) h.Size = Vector3.new(3, 1.2, 3) h.Position = Vector3.new(mouse.Hit.p) while true do wait() h:Destroy() wait() local h = Instance.new("Part", Workspace) h.Color = Color3.new(1, 1, 1) h.CanCollide = false h.Rotation = Vector3.new(0, 0, 0.1) h.Size = Vector3.new(3, 1.2, 3) while true do wait() h.Position = Vector3.new(mouse.Hit.p) end end end
script.Parent.Selected:connect(onSelected) script.Parent.Deselected:connect(function() h:Destroy() end) |
|
|
| Report Abuse |
|
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
| |
|
|
| 07 Dec 2013 12:58 AM |
| add the part to the mouse's ignore list or to the local character. |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 07 Dec 2013 12:59 AM |
| Oh and make all local h into just h |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 07 Dec 2013 01:00 AM |
Shesh.......
repeat wait (0) until game.Players.LocalPlayer and game.Players.LocalPlayer.Character mouse.Move:connect(function() a = game.Lighting.Block:Clone() a.CFrame = CFrame.new (mouse.Hit.p) end)
this will move the block to your mouse |
|
|
| Report Abuse |
|
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
|
| 07 Dec 2013 01:01 AM |
I dont want to use lightning
|
|
|
| Report Abuse |
|
|
|
| 07 Dec 2013 01:03 AM |
^Every time a person using that script moves the mouse... A new brick is made...
repeat wait (0) until game.Players.LocalPlayer and game.Players.LocalPlayer.Character mouse.Move:connect(function() a = a or game.Lighting.Block:Clone() a.CFrame = CFrame.new (mouse.Hit.p) end)
should fix that problem at least.... trusting that keven knew what he was making... |
|
|
| Report Abuse |
|
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
| |
|
Truste135
|
  |
| Joined: 26 Oct 2010 |
| Total Posts: 741 |
|
|
| 07 Dec 2013 01:09 AM |
| Trying to index mouse a nil value |
|
|
| Report Abuse |
|
|
|
| 07 Dec 2013 01:13 AM |
If you want to use that script as stand alone, you'd have to define a few of the variables used:
repeat wait (0) until game.Players.LocalPlayer and game.Players.LocalPlayer.Character mouse = game.Players.LocalPlayer:GetMouse() local a local db = false mouse.Move:connect(function() if not db then db = true a = a or game.Lighting.Block:Clone() a.CFrame = CFrame.new(mouse.Hit.p) wait() db = false end end)
Also added db, so there is less lag. |
|
|
| Report Abuse |
|
|
longbow12
|
  |
| Joined: 20 Sep 2008 |
| Total Posts: 565 |
|
|
| 07 Dec 2013 04:07 AM |
| Use mouse.Hit.p instead of mouse.Target, also I made something similar to what you're trying to do recently and I used CFrame to move the brick, perhaps you wanna try that. |
|
|
| Report Abuse |
|
|