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: Holographic Brick

Previous Thread :: Next Thread 
Truste135 is not online. 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 is not online. Truste135
Joined: 26 Oct 2010
Total Posts: 741
06 Dec 2013 11:05 AM
bump [1]
Report Abuse
Truste135 is not online. Truste135
Joined: 26 Oct 2010
Total Posts: 741
06 Dec 2013 11:23 AM
bump [2]
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
06 Dec 2013 11:24 AM
mouse.Target.p
Report Abuse
Truste135 is not online. 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 is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
06 Dec 2013 11:26 AM
No problem! Croatia indeed.
Report Abuse
Truste135 is not online. 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 is not online. 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
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
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 is not online. 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 is not online. 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 is not online. Truste135
Joined: 26 Oct 2010
Total Posts: 741
06 Dec 2013 11:47 AM
bump [3]
Report Abuse
Truste135 is not online. Truste135
Joined: 26 Oct 2010
Total Posts: 741
06 Dec 2013 11:53 AM
bump [4]
Report Abuse
Truste135 is not online. Truste135
Joined: 26 Oct 2010
Total Posts: 741
07 Dec 2013 12:50 AM
bump [5]

i am getting tired
Report Abuse
wazap is not online. 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 is not online. Truste135
Joined: 26 Oct 2010
Total Posts: 741
07 Dec 2013 12:58 AM
bump [6]

halp gosh
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
07 Dec 2013 12:58 AM
add the part to the mouse's ignore list or to the local character.
Report Abuse
wazap is not online. 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 is not online. 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 is not online. Truste135
Joined: 26 Oct 2010
Total Posts: 741
07 Dec 2013 01:01 AM
I dont want to use lightning
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
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 is not online. Truste135
Joined: 26 Oct 2010
Total Posts: 741
07 Dec 2013 01:05 AM
Ill give it a try...
Report Abuse
Truste135 is not online. Truste135
Joined: 26 Oct 2010
Total Posts: 741
07 Dec 2013 01:09 AM
Trying to index mouse a nil value
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
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 is not online. 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
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