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
 

Scripting Help

Previous Thread :: Next Thread 
Archer7 is not online. 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 is not online. 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 is not online. 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
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