Archer7
|
  |
| Joined: 24 Nov 2008 |
| Total Posts: 25 |
|
|
| 31 Jul 2011 08:03 PM |
For a Tool, I need it to spawn a single rock in front of the player. Once the Rock has been spawned, The tool deletes itself. Also, When the player dies, the rock needs to delete itself also.
The reason is because im pairing the rock tool with a telekinesis tool for a war place. I want the player to feel like they only have one weapon and cant lose it. Once the player is killed in action, the rock needs to clean itself up, therefore removed.
Thanks in Advance. |
|
|
| Report Abuse |
|
|
Archer7
|
  |
| Joined: 24 Nov 2008 |
| Total Posts: 25 |
|
|
| 31 Jul 2011 08:09 PM |
Here is the script. What do I add to it in order for it to work? The Rock is stored in Lighting BTW:
bin = script.Parent me = bin.Parent.Parent Cursor = {} Cursor["gun"] = "rbxasset://textures\\GunCursor.png"
function Idle(mouse)
end
function getkey(key, rkey) if key == rkey then return true else return false end end
function keypush(key) key = key:lower()
end
function onButton1Down(mouse) local part = game.Lighting.Part:Clone() part.Parent = game.Workspace part.Name = "Rock" part.BrickColor = BrickColor.new("Black") part.Anchored = false part.CanCollide = true part.Position = mouse.Hit.p
part.Parent = game.Workspace
end
function onButton1Up(mouse)
end
function onSelected(mouse) mouse.Icon = Cursor["gun"] mouse.Button1Down:connect(function() onButton1Down(mouse) end) mouse.Button1Up:connect(function() onButton1Up(mouse) end) mouse.Idle:connect(function() Idle(mouse) end) mouse.KeyDown:connect(keypush) end
function deselect(mouse)
end
bin.Deselected:connect(deselect) bin.Selected:connect(onSelected)
|
|
|
| Report Abuse |
|
|
scepile3
|
  |
| Joined: 27 Feb 2009 |
| Total Posts: 260 |
|
|
| 31 Jul 2011 10:13 PM |
| To make the rock appear in front of the player, you might want to combine the lookvector of the torso and the cframe of the torso to change the rock's position. After that, you could just remove the tool using remove()... |
|
|
| Report Abuse |
|
|