|
| 19 Jun 2014 05:59 PM |
I've tried this, no errors but it does not clone to where the Player Mouse Position is, it just spawns off the BasePlate, not that far away.
Script Below v;
local player = game.Players.LocalPlayer Mouse = player:GetMouse() Mouse.Button1Down:connect(function()
while wait() do if Mouse.Target.Name == "Create" then block = Mouse.Target new = Mouse.Target:Clone() new.Parent = game.Workspace new.Position = Vector3.new(Mouse.X, 4.19, Mouse.Y) new.Color = BrickColor.Random().Color end break end end)
Any help? |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:03 PM |
Mouse.X is the position on the SCREEN, not the WORLD.
Use Mouse.Hit.X and Mouse.Hit.Z |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 19 Jun 2014 06:04 PM |
Vector3.new(Mouse.X, 4.19, Mouse.Y)
Screen position isn't the same as world position. Use mouse.Hit instead.
(Also that while loop is completely redundant) |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 19 Jun 2014 06:04 PM |
local player = game.Players.LocalPlayer Mouse = player:GetMouse() Mouse.Button1Down:connect(function()
while wait() do if Mouse.Target.Name == "Create" then block = Mouse.Target new = Mouse.Target:Clone() new.Parent = game.Workspace new.Position = Vector3.new(Mouse.Hit.p.x, 4.19, Mouse.Hit.p.y) new.Color = BrickColor.Random().Color break end end end)
|
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:07 PM |
| It spawns closer, like 10 feet close to it but not at the Clicked Position. Maybe I can work around it. |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:07 PM |
| @cxcharlie: Last I checked CFrame had X, Y and Z values, making the .p useless. Also, he probably wants Hit.z for the Z component. |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:08 PM |
@Rofl I know that. I used the Mouses X and Y to calculate where the block will go on the screen and 4.19 is weird it should spawn above the baseplate. |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:09 PM |
| Are you sure you are converting X and Y to the world space correctly? |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:10 PM |
| @cx It spawns closer to the block but It isn't at it's direct location. |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:11 PM |
| Can you link me to somewhere I can test the script to see the issue for myself? |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:12 PM |
Okay http://www.roblox.com/item.aspx?id=141123951 |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:15 PM |
| It spawns closer to the part itself but not the actual Mouse Position |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:22 PM |
local player = game.Players.LocalPlayer Mouse = player:GetMouse() Mouse.Button1Down:connect(function() target = Mouse.Target if target and target.Name == 'Create' then new = target:Clone() new.Parent = workspace new.CFrame = CFrame.new(Mouse.hit.X, 4.19, Mouse.hit.Z)--I'm assuming you meant Z new.Color = BrickColor.Random().Color end end) |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:25 PM |
Notunknown helped me fix it, ty :)
[Closed] |
|
|
| Report Abuse |
|
|
| |
|