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
 

Re: I have a question....

Previous Thread :: Next Thread 
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
07 Apr 2012 11:47 AM
So, is there a way to make it so when you grab a gun, and you die, the gun falls to the floor and you can get it by going back to the site of your death?

This is NOT a request, tell me what I should do, I'll do it myself.


Unless you want to give me a script, which would be a waste of your time :P
Report Abuse
bagwan12345 is not online. bagwan12345
Joined: 17 Dec 2009
Total Posts: 1498
07 Apr 2012 11:51 AM
When your character dies, you can clone() the tool to the workspace (AND "ANCHOR+CANCOLLIDE=true" THE HANDLE INSIDE IT OR IT WILL FALL)
and leave it at the spot of your torso (or head, doesn't matter).


Add a "StringValue" inside the tool with the Value being the name of the person who had the tool.

Make it so that only if the thing that touches the tool's name is (StringValue.Value) then it will be picked up...else it will "return end"
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
07 Apr 2012 11:53 AM
Thanks, the first part seems simple enough... I'll just have to figure out the last 2 parts.











~You can't blame people for their stupidity, but you can blame them for their stupid actions.~
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
07 Apr 2012 11:58 AM
Perhaps a .Died event of the Humanoid? I don't know if it will fire fast enough before the gun is gone...

And the other guy's suggestion that you didn't understand would be necessary if you only want that same person to get it. Otherwise skip it and the gun is free game for everyone.

† KMXD †
Report Abuse
bagwan12345 is not online. bagwan12345
Joined: 17 Dec 2009
Total Posts: 1498
07 Apr 2012 11:59 AM
I didn't really think this ahead, but try it anyways:


--Put the script alone inside the tool (The tool in StarterPack)

ToolLocation = script.Parent
s = Instance.new("StringValue",ToolLocation)
s.Value = game.Players.LocalPlayer.Name

function touch(hit)
if hit.Parent:findFirstChild("Humanoid") and hit.Parent.Name == StringValue.Value then
print("Rightful owner")
else
ToolLocation.Parent = game.Workspace
ToolLocation.Position = game.Players.LocalPlayer.Character.Torso.Position
print("Wrong person")

end end
ToolLocation:findFirstChild(PartName).Touched:connect(touch)


--This MIGHT work, I'm not sure, so yeah.
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
07 Apr 2012 12:33 PM
Try this :D

game.Players.PlayerAdded:connect(function(player)
repeat player.Changed:wait() until player.Character
player.CharacterAdded:connect(function(character)
repeat character.ChildAdded:wait() until character:findFirstChild("Humanoid")
character.Humanoid.Died:connect(function()
for _, item in pairs(character:GetChildren()) do
if item:IsA("Tool") or item:IsA("HopperBin") then
carryingPackage = Instance.new("Model",Workspace)
carryingPackage.Name = item.Name
item:Clone().Parent = carryingPackage
carryingPackage:MoveTo(character["Right Arm"].CFrame.p+Vector3.new(0,3,0))
item.Parent = Workspace
carryingPackage:Destroy()
print("Successfully dropped "..item.Name)
end
end
end)
end)
end)
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
07 Apr 2012 01:05 PM
Ok, i'll try this, thanks.







~You can't blame people for their stupidity, but you can blame them for their stupid actions.~
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
07 Apr 2012 01:07 PM
The thing is, the tool is available in this game to grab. So, its not the StarterPack, you find the gun and then I want it to be you lose it if you die, but you can get it back if you find where you died.









~You can't blame people for their stupidity, but you can blame them for their stupid actions.~
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
07 Apr 2012 02:08 PM
Bump.







~I don't always forum, but when I do, I forum like a boss.~
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
07 Apr 2012 02:13 PM
Bump.






~I don't always forum, but when I do, I forum like a boss.~
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
07 Apr 2012 04:27 PM
So you don't want someone else to be able to pick it up?
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
07 Apr 2012 04:29 PM
No I do, but the gun isn't going to be in the StarterPack, it will be hidden for you to find somewhere in the map, so once you have it it will fall and you will have to find where you died to get it back.









~I don't always forum, but when I do, I forum like a boss.~
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
07 Apr 2012 04:30 PM
That's what the script I wrote does...
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
07 Apr 2012 04:32 PM
I was wondering why it said HopperBin though... if I'm talking about a gun.









~I don't always forum, but when I do, I forum like a boss.~
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
07 Apr 2012 04:34 PM
Just realized I can't drop a hopperbin. Just remove the '..or item:IsA("HopperBin")' part.
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
07 Apr 2012 04:35 PM
Can't i edit it to say what the gun's name is?





~I don't always forum, but when I do, I forum like a boss.~
Report Abuse
abaw7 is not online. abaw7
Joined: 23 Oct 2009
Total Posts: 745
07 Apr 2012 04:41 PM
Epic that only works if they have the gun out when they die. I don't feel like making it check backpack as well but it should.
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
08 Apr 2012 11:53 AM
@abaw7; That was intentional. I thought that was what he wanted.
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