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 » Scripters
Home Search
 

Re: How do I allow hats to be dropped in-game?

Previous Thread :: Next Thread 
J_acob is online. J_acob
Joined: 26 Feb 2016
Total Posts: 926
22 Jan 2017 11:19 PM
I want to drop hats in my game.


Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
22 Jan 2017 11:20 PM
local function dropHats()
local localPlayer = game:GetService("Players").LocalPlayer
if localPlayer and localPlayer.Character then
for _, obj in pairs(localPlayer.Character:GetChildren()) do
if obj:IsA("Accoutrement") then
obj.Parent = game.Workspace
end
end
end
end

game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.KeyCode == Enum.KeyCode.Equals then
dropHats()
end
end
end)


Report Abuse
J_acob is online. J_acob
Joined: 26 Feb 2016
Total Posts: 926
22 Jan 2017 11:24 PM
doesn't work


Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
22 Jan 2017 11:32 PM
Put it in a localscript in StarterPlayerScripts.


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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