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: This ever work?

Previous Thread :: Next Thread 
xXShadowPrimeXx is not online. xXShadowPrimeXx
Joined: 31 Jul 2010
Total Posts: 981
11 May 2016 06:23 PM
I'm really new to this.. I'm tryin to make so when player on start their hats get auto removed Script

" script.Parent:GetChildren()
for i=1, #d do
if (d[i].className == "Hat") then
d[i]:remove() "

I just can't get it to work...


Report Abuse
PraetorianTheGod is not online. PraetorianTheGod
Joined: 02 May 2014
Total Posts: 814
11 May 2016 06:24 PM
d = script.Parent:GetChildren()
for i=1, #d do
if (d[i].className == "Hat") then
d[i]:remove()
Report Abuse
xXShadowPrimeXx is not online. xXShadowPrimeXx
Joined: 31 Jul 2010
Total Posts: 981
11 May 2016 06:25 PM
Still don't work...



Report Abuse
PraetorianTheGod is not online. PraetorianTheGod
Joined: 02 May 2014
Total Posts: 814
11 May 2016 06:27 PM
d = script.Parent:GetChildren()
for i=1, #d do
if (d[i].className == "Hat") then
d[i]:remove()
end
end
Report Abuse
xXShadowPrimeXx is not online. xXShadowPrimeXx
Joined: 31 Jul 2010
Total Posts: 981
11 May 2016 06:30 PM
Nope Thanks for tryin i'll just see if i can pay someone to help me fix it...


Report Abuse
PraetorianTheGod is not online. PraetorianTheGod
Joined: 02 May 2014
Total Posts: 814
11 May 2016 06:30 PM
it works for me lol
Report Abuse
xXShadowPrimeXx is not online. xXShadowPrimeXx
Joined: 31 Jul 2010
Total Posts: 981
11 May 2016 06:31 PM
Wait what...

Does it...


Report Abuse
PraetorianTheGod is not online. PraetorianTheGod
Joined: 02 May 2014
Total Posts: 814
11 May 2016 06:31 PM
how are you using the script
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
11 May 2016 06:32 PM
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
for i,v in pairs(char:GetChildren() do
if v:IsA"Hat" then
v:Destroy()
end
end
end)
end)


tell me if it works
Report Abuse
xXShadowPrimeXx is not online. xXShadowPrimeXx
Joined: 31 Jul 2010
Total Posts: 981
11 May 2016 06:33 PM
Grrr still spawning with my hats....


Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
11 May 2016 06:34 PM
smal mistake forgot a paranthesis

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
for i,v in pairs(char:GetChildren()) do
if v:IsA"Hat" then
v:Destroy()
end
end
end)
end)
Report Abuse
lululukas is not online. lululukas
Joined: 23 Aug 2010
Total Posts: 1043
11 May 2016 06:35 PM
^ he was just correcting your code which doesn't even make sense, it's you that messed up and gave misleading info

put this in starterplayerscripts (local script)

me=game.Players.LocalPlayer
repeat wait() until me.Character
for i,v in pairs(me.Character:GetChildren()) do
if v:IsA"Hat" then
v:Destroy()
end
end
Report Abuse
xXShadowPrimeXx is not online. xXShadowPrimeXx
Joined: 31 Jul 2010
Total Posts: 981
11 May 2016 06:37 PM
Chill bro.. Like i said i'm a big noob at this.. lol


Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
11 May 2016 06:37 PM
Get outta here. That dont work either
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
11 May 2016 06:38 PM
Shadow make that a script in workspace or serverscriptstorage.

not lcoalscript
Report Abuse
xXShadowPrimeXx is not online. xXShadowPrimeXx
Joined: 31 Jul 2010
Total Posts: 981
11 May 2016 06:38 PM
Ahh okay.


Report Abuse
lululukas is not online. lululukas
Joined: 23 Aug 2010
Total Posts: 1043
11 May 2016 06:39 PM
@TheCoder

Sorry I wasn't referring to you, I was referring to OP, your post wasn't made before i started writing the reply

Also why wouldn't that work? seems perfectly fine to me.
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
11 May 2016 06:42 PM
local Players = game:GetService("Players")
local Debris = game:GetService("Debris")
local PlayerAdded, CharacterAdded, HatHandler, Spawn

function PlayerAdded(player)
Spawn(CharacterAdded, player.Character or player.CharacterAdded:wait())
player.CharacterAdded:connect(CharacterAdded)
end

function CharacterAdded(character)
for _, obj in ipairs(character:GetChildren()) do
Spawn(HatHandler, obj)
end
character.ChildAdded:connect(HatHandler)
end

function HatHandler(obj)
if obj:IsA("Hat") then
Debris:AddItem(obj,0)
end
end

function Spawn(func, ...)
local args={...}
spawn(function()
func(unpack(args))
end)
end

for _, player in ipairs(Players:GetPlayers()) do
Spawn(PlayerAdded, player)
end

Players.PlayerAdded:connect(PlayerAdded)
Report Abuse
xXShadowPrimeXx is not online. xXShadowPrimeXx
Joined: 31 Jul 2010
Total Posts: 981
11 May 2016 06:43 PM
Thanks but still not working its prob me doing it wrong..


Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
11 May 2016 06:43 PM
cause hats take a little to load.

In CharacterAdded its already loaded. iirc
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
11 May 2016 06:45 PM
@Shadow Make sure you are not using ServerStorage, place my code in a normal script inside of ServerScriptService.
Report Abuse
xXShadowPrimeXx is not online. xXShadowPrimeXx
Joined: 31 Jul 2010
Total Posts: 981
11 May 2016 06:46 PM
Wow thanks @Casualist and The Coder It worked.. if you need currency give me a shout i'll hook you up with something. ;)


Report Abuse
lululukas is not online. lululukas
Joined: 23 Aug 2010
Total Posts: 1043
11 May 2016 06:46 PM
@Casual

Why overcomplicate it like that?
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
11 May 2016 06:49 PM
Well I need a graphic art for my game.
Are you a graphic artist? or..?
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
11 May 2016 06:49 PM
Because OP was having problems getting anyone's code to work. So I just made it almost foolproof. That works as a normal script, as a local script, if you append it to the bottom of existing code (i.e. code with waits, so if it runs late and a player(s) is already in game that player's hats get removed still).
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