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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 02 Sep 2007 |
| Total Posts: 339 |
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 02 Sep 2007 |
| Total Posts: 339 |
|
| |
|
Chubs1995
|
  |
| Joined: 02 Sep 2007 |
| Total Posts: 339 |
|
| |
|
Chubs1995
|
  |
| Joined: 02 Sep 2007 |
| Total Posts: 339 |
|
| |
|