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: HELP?

Previous Thread :: Next Thread 
Chubs1995 is not online. Chubs1995
Joined: 02 Sep 2007
Total Posts: 339
31 Dec 2013 10:02 PM
This script is SUPPOSED to remove the hat of my character and replace it with a different hat when I spawn. However, it is not working. Also, the second to last line has a red line under it, but it's not telling me what the error is.
Can anyone help me out please?

local hatId = 15967743
local removeHat = {["Chubs1995"]=true}

local hat = game:GetService("InsertService"):LoadAsset(hatId)

game.Players.PlayerAdded:connect(function(plr)
if removeHat[plr.name] then
plr.CharacterAdded:connect(function(char)
wait(1)
for i,v in pairs(char:GetChildren()) do
if v:IsA("Hat") then
v:Destroy()
end
end
for i,v in pairs(hat:GetChildren()) do
if v:IsA("Hat") then
v:Clone().Parent = char
end
end
end
end)
end)
Report Abuse
N8X is not online. N8X
Joined: 15 Nov 2013
Total Posts: 1665
31 Dec 2013 10:04 PM
I honestly don't think there is a 'Hat' for IsA, try
if v:FindFirstChild("Handle") then


#N8XAdminCommands
Report Abuse
N8X is not online. N8X
Joined: 15 Nov 2013
Total Posts: 1665
31 Dec 2013 10:06 PM
The last three end statments have a little mix up,
'end
end)
end)'
should be
'end)
end
end)'


#N8XAdminCommands
Report Abuse
Chubs1995 is not online. Chubs1995
Joined: 02 Sep 2007
Total Posts: 339
31 Dec 2013 10:29 PM
It didn't work.

local hatId = 15967743
local removeHat = {["Chubs1995"]=true}

local hat = game:GetService("InsertService"):LoadAsset(hatId)

game.Players.PlayerAdded:connect(function(plr)
if removeHat[plr.name] then
plr.CharacterAdded:connect(function(char)
wait(1)
for i,v in pairs(char:GetChildren()) do
if v:FindFirstChild("Handle") then
v:Destroy()
end
end
for i,v in pairs(hat:GetChildren()) do
if v:IsA("Hat") then
v:Clone().Parent = char
end
end
end)
end
end)
Report Abuse
Chubs1995 is not online. Chubs1995
Joined: 02 Sep 2007
Total Posts: 339
01 Jan 2014 01:57 PM
Hello?
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
01 Jan 2014 01:58 PM
hover your mouse over the underlined error line and it will tell you what the problem is

and yes, IsA() works for hats, don't mislead.
Report Abuse
Chubs1995 is not online. Chubs1995
Joined: 02 Sep 2007
Total Posts: 339
01 Jan 2014 02:28 PM
The error is gone, but it's still not working. I've tried

local hatId = 15967743
local removeHat = {["Chubs1995"]=true}

local hat = game:GetService("InsertService"):LoadAsset(hatId)

game.Players.PlayerAdded:connect(function(plr)
if removeHat[plr.name] then
plr.CharacterAdded:connect(function(char)
wait(1)
for i,v in pairs(char:GetChildren()) do
if v:IsA("Hat") then
v:Destroy()
end
end
for i,v in pairs(hat:GetChildren()) do
if v:IsA("Hat") then
v:Clone().Parent = char
end
end
end)
end
end)

AND

local hatId = 15967743
local removeHat = {["Chubs1995"]=true}

local hat = game:GetService("InsertService"):LoadAsset(hatId)

game.Players.PlayerAdded:connect(function(plr)
if removeHat[plr.name] then
plr.CharacterAdded:connect(function(char)
wait(1)
for i,v in pairs(char:GetChildren()) do
if v:FindFirstChild("Handle") then
v:Destroy()
end
end
for i,v in pairs(hat:GetChildren()) do
if v:FindFirstChild("Handle") then
v:Clone().Parent = char
end
end
end)
end
end)

Neither are working.
Report Abuse
Chubs1995 is not online. Chubs1995
Joined: 02 Sep 2007
Total Posts: 339
01 Jan 2014 06:23 PM
:/
Report Abuse
Chubs1995 is not online. Chubs1995
Joined: 02 Sep 2007
Total Posts: 339
01 Jan 2014 07:28 PM
........
Report Abuse
Chubs1995 is not online. Chubs1995
Joined: 02 Sep 2007
Total Posts: 339
02 Jan 2014 03:46 AM
Ugh
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