darkwisp
|
  |
| Joined: 07 Apr 2010 |
| Total Posts: 22653 |
|
|
| 29 Jun 2014 02:30 AM |
The property, mouse.hit
SO far Wherever I click, the brick spawns, but I want it to snap unto the part I click on.
This is just part of it =====
lifetime = 2 -- how long the boulder stays there. 5 is a good value. player = game.Players.LocalPlayer function onButton1Down(mouse) if mouse.Target~=nil then local hit = mouse.Target local body = game.Players.LocalPlayer.Character:findFirstChild("Torso") if mouse.Target.ClassName == "Part" and (hit~=nil) and body.Position.x - hit.Position.x < 30 and body.Position.x - hit.Position.x > -30 and body.Position.y - hit.Position.y < 30 and body.Position.y - hit.Position.y > -30 and body.Position.z - hit.Position.z < 30 and body.Position.z - hit.Position.z > -30 then if player.Character.Energy.Value >= 5 then if game.Workspace.DefenderTeamTurn.Value == true then if player.TeamColor == BrickColor.new("Bright violet") then player.Character.Energy.Value = player.Character.Energy.Value - 5 local b = Instance.new("Part") b.BrickColor = BrickColor.new("Bright violet") b.Position = mouse.Hit.p b.Size = Vector3.new(5, 5, 5) b.Shape = 1 b.Anchored = true b.Parent = game.Workspace b.CanCollide = false local new_script = script.Parent.Damage:clone() new_script.Disabled = false new_script.Parent = b
local creator_tag = Instance.new("ObjectValue") creator_tag.Value = vPlayer creator_tag.Name = "creator" creator_tag.Parent = b
--b.Velocity = (script.Parent.Parent.Parent.Character.Head.Position - mouse.Hit.p).unit * -50 + Vector3.new(0, 10, 0) b.CFrame = CFrame.new(mouse.Target.Position) game:GetService("Debris"):AddItem(b, lifetime) end end
But seriously, join The Collision. |
|
|
| Report Abuse |
|
darkwisp
|
  |
| Joined: 07 Apr 2010 |
| Total Posts: 22653 |
|
|
| 29 Jun 2014 02:32 AM |
Oops, not the mouse.hit property
I mean the mouse.Target property.
But seriously, join The Collision. |
|
|
| Report Abuse |
|
darkwisp
|
  |
| Joined: 07 Apr 2010 |
| Total Posts: 22653 |
|
|
| 29 Jun 2014 02:38 AM |
nvm, figured it out myself
But seriously, join The Collision. |
|
|
| Report Abuse |
|