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: can somone make a "no hats aloud" script?

Previous Thread :: Next Thread 
tanlolol12345 is not online. tanlolol12345
Joined: 20 Jan 2012
Total Posts: 20664
31 May 2014 10:41 AM
basically it should just remove hats from players.
ive seen it before but there are no models.

I believe its latin for "Skip the boring parts".
Report Abuse
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
31 May 2014 10:43 AM
Just loop through characters, check for hats then delete hats.
Report Abuse
tanlolol12345 is not online. tanlolol12345
Joined: 20 Jan 2012
Total Posts: 20664
31 May 2014 10:45 AM
eh....

I believe its latin for "Skip the boring parts".
Report Abuse
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
31 May 2014 10:46 AM
Use :GetChildren() and a for loop.
Report Abuse
tanlolol12345 is not online. tanlolol12345
Joined: 20 Jan 2012
Total Posts: 20664
31 May 2014 10:47 AM
ill say it once
i cant script very well and pretty much 97/100 of the functions i have no idea.

I believe its latin for "Skip the boring parts".
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
31 May 2014 10:53 AM
-- localscript in startergui

local player = game.Players
repeat wait() until player
player.CharacterAdded:connect(function()
for i, v in pairs(player.Character:GetChildren()) do
if v:IsA("Hat") then
v:Destroy()
end
end
end)

should work...
Report Abuse
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
31 May 2014 10:54 AM
Looks good.
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
31 May 2014 10:55 AM
crap

-- localscript in startergui

local player = game.Players.LocalPlayer
repeat wait() until player
player.CharacterAdded:connect(function()
for i, v in pairs(player.Character:GetChildren()) do
if v:IsA("Hat") then
v:Destroy()
end
end
end)


I messed up on the player variable, I fixed it
Report Abuse
tanlolol12345 is not online. tanlolol12345
Joined: 20 Jan 2012
Total Posts: 20664
31 May 2014 10:56 AM
@chop
that doesnt work becuase it is looking for hats in the player, not the player's model.

I believe its latin for "Skip the boring parts".
Report Abuse
tanlolol12345 is not online. tanlolol12345
Joined: 20 Jan 2012
Total Posts: 20664
31 May 2014 10:57 AM
@chop
sorry, late post.
its not doing anything, its removing the shirt?...

I believe its latin for "Skip the boring parts".
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
31 May 2014 11:04 AM
-- localscript in startergui

local player = game.Players.LocalPlayer
wait(1)
for i, v in pairs(player.Character:GetChildren()) do
if v:IsA("Hat") then
v:Destroy()
end
end

Ok I needed to add a wait cause the hats are added like 1 second after your character is.
Report Abuse
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
31 May 2014 11:06 AM
player:WaitForChild("Character")
Report Abuse
tanlolol12345 is not online. tanlolol12345
Joined: 20 Jan 2012
Total Posts: 20664
31 May 2014 11:07 AM
still wont work after tinkering with the wait().
did you ever try to get the playermodel from the playerinstance?

I believe its latin for "Skip the boring parts".
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
31 May 2014 11:08 AM
The code I posted works for me. Try changing it to wait(2)
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
31 May 2014 11:08 AM
"player:WaitForChild("Character")"

When I looped the character, I printed the values and the hat didn't show up. You have to add a wait to it.
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
31 May 2014 11:09 AM
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
wait(3);
for i,v in pairs(char:GetChildren()) do
if v:IsA('Hat') and v:findFirstChild('Handle') then
v:Destroy();
end
end
end)
end)

Report Abuse
tanlolol12345 is not online. tanlolol12345
Joined: 20 Jan 2012
Total Posts: 20664
31 May 2014 11:09 AM
"Try changing it to wait(2)"
ive changed it to even wait 10 and it still doesnt work.

I believe its latin for "Skip the boring parts".
Report Abuse
TehIcyStar is not online. TehIcyStar
Joined: 07 Mar 2010
Total Posts: 1649
31 May 2014 11:10 AM
here's one that removes hats when a character spawns. Put script in workspace.

game.Players.PlayerAdded:connect(function (plyr)
plyr.CharacterAdded:connect(function (char)
wait()
local charstuff = char:GetChildren()
for i=1.#charstuff do
if charstuff[i].ClassName == "Hat" then
charstuff[i]:Destroy()
end
end
end)
end)
Report Abuse
tanlolol12345 is not online. tanlolol12345
Joined: 20 Jan 2012
Total Posts: 20664
31 May 2014 11:10 AM
@verified
that doesnt work either...

I believe its latin for "Skip the boring parts".
Report Abuse
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
31 May 2014 11:11 AM
player:WaitForFkinChild("Character")
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
31 May 2014 11:11 AM
how are you testing it.

Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
31 May 2014 11:11 AM
Look up hat remover
Report Abuse
tanlolol12345 is not online. tanlolol12345
Joined: 20 Jan 2012
Total Posts: 20664
31 May 2014 11:12 AM
@tecicy
nope, still doesnt work...

I believe its latin for "Skip the boring parts".
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
31 May 2014 11:12 AM
Did you wait 10 seconds? lol
Report Abuse
TehIcyStar is not online. TehIcyStar
Joined: 07 Mar 2010
Total Posts: 1649
31 May 2014 11:12 AM
Verified's should work, Mine should too.

Remember, put the code in a NON local script in workspace.
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