Aperturee
|
  |
| Joined: 22 Jan 2013 |
| Total Posts: 306 |
|
|
| 29 Aug 2015 11:12 AM |
I'm currently working on a game which is building-based, and I need help with a tool I'll be using. I made a delete tool that uses this script:
function Select(m)
if m ~= nil then m.Icon = "http://www.roblox.com/asset/?id=75153367" end
function onClick() local ray = Ray.new(script.Parent.Parent.Parent.Character.Head.Position,(m.hit.p-script.Parent.Parent.Parent.Character.Head.Position).Unit*900) local hit = workspace:FindPartOnRay(ray,script.Parent.Parent.Parent.Character) if hit ~= nil then if hit.Locked == false then hit.Material = "Plastic" hit.BrickColor = BrickColor.new("Bright red") hit.Transparency = 0.3 local x = Instance.new("Explosion",workspace) x.Position = hit.Position x.BlastPressure = 0 x.BlastRadius = 1 wait(0.05) x:Destroy() hit:Destroy() end end end m.Button1Up:connect(onClick)
end script.Parent.Selected:connect(Select)
So, I don't know how to limit the actual function. For example, you're 10 studs away, and you can't delete pass 10 studs. Thanks in advance. |
|
|
| Report Abuse |
|
|
AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 29 Aug 2015 11:49 AM |
| To restrict the studs to 10, change the 900 to a 10 |
|
|
| Report Abuse |
|
|
Aperturee
|
  |
| Joined: 22 Jan 2013 |
| Total Posts: 306 |
|
|
| 29 Aug 2015 01:41 PM |
| Thanks mate, works like a charm. |
|
|
| Report Abuse |
|
|
Aperturee
|
  |
| Joined: 22 Jan 2013 |
| Total Posts: 306 |
|
|
| 29 Aug 2015 02:11 PM |
| Thanks mate, works like a charm. |
|
|
| Report Abuse |
|
|