georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
|
| 21 Aug 2015 03:03 PM |
I have a model in lighting with multiple CSG Hats. The line where it says local Hats = game.Lighting.Hats:GetChildren() doesn't work but it does work when it is like: local Hats = game.Lighting.Hats.TopHat
Why is this?
function onPlayerEntered(newPlayer) wait(3) local Hats = game.Lighting.Hats:GetChildren() local HatsClone = Hats:Clone() HatsClone.Parent = newPlayer.Character HatsClone.Anchored = false local w = Instance.new("ManualWeld") w.Parent = newPlayer.Character w.Part0 = HatsClone w.Part1 = newPlayer.Character.Head w.C0 = CFrame.new(0, -.8, 0)*CFrame.new(0,0, 0) end
game.Players.PlayerAdded:connect(onPlayerEntered) |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 21 Aug 2015 03:09 PM |
you want to clone all the hats? um ok if hats your thing
-- store in server storage scrub game.Players.PlayerAdded:connect(function(newPlayer) player.CharacterAdded:connect(function(char) wait(3) local hats = game.ServerStorage.Hats:GetChildren() for i =1, #hats do local HatsClone = hats[i]:Clone() HatsClone.Parent = newPlayer.Character HatsClone.Anchored = false local w = Instance.new("ManualWeld", char) w.Parent = char w.Part0 = HatsClone w.Part1 = char.Head w.C0 = CFrame.new(0, -.8, 0)*CFrame.new(0,0, 0) end end) end)
Bʀᴏ ᴅᴏ ʏᴏᴜ ᴇᴠᴇɴ Lᴜᴀ? |
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
| |
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 21 Aug 2015 03:12 PM |
mhm any time
Bʀᴏ ᴅᴏ ʏᴏᴜ ᴇᴠᴇɴ Lᴜᴀ? |
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
|
| 21 Aug 2015 03:18 PM |
Last question... Let's say my layout is like this -ServerStorage --Hats ---Sunglasses Model ----Parts
Like, if one of my hats was inside a model what would I change? |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 21 Aug 2015 03:22 PM |
huh? elaborate
Bʀᴏ ᴅᴏ ʏᴏᴜ ᴇᴠᴇɴ Lᴜᴀ? |
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
|
| 21 Aug 2015 03:23 PM |
| So some of my hats have multiple parts, and so I had to group them. Right now when I put the group into the model Hats they don't clone to the player |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 21 Aug 2015 03:25 PM |
-- store in server storage scrub game.Players.PlayerAdded:connect(function(newPlayer) player.CharacterAdded:connect(function(char) wait(3) local hats = game.ServerStorage.Hats:GetChildren() for i =1, #hats do if not hats[i]:IsA"Model" then local HatsClone = hats[i]:Clone() HatsClone.Parent = newPlayer.Character HatsClone.Anchored = false local w = Instance.new("ManualWeld", char) w.Parent = char w.Part0 = HatsClone w.Part1 = char.Head w.C0 = CFrame.new(0, -.8, 0)*CFrame.new(0,0, 0) else for _, v in pairs(hats[i]:GetChildren()) do local HatsClone = v:Clone() HatsClone.Parent = newPlayer.Character HatsClone.Anchored = false local w = Instance.new("ManualWeld", char) w.Parent = char w.Part0 = HatsClone w.Part1 = char.Head w.C0 = CFrame.new(0, -.8, 0)*CFrame.new(0,0, 0) end end end end) end)
Bʀᴏ ᴅᴏ ʏᴏᴜ ᴇᴠᴇɴ Lᴜᴀ? |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 21 Aug 2015 03:26 PM |
| Maybe use hat instances? There is a reason they are there. |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 21 Aug 2015 03:26 PM |
yeah use hat instances, far better but w/e floats your boat
Bʀᴏ ᴅᴏ ʏᴏᴜ ᴇᴠᴇɴ Lᴜᴀ? |
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
|
| 21 Aug 2015 03:26 PM |
| No no, for what I'm doing I need to use this. I want the user to not be able to drop it |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 21 Aug 2015 03:28 PM |
w/e did my script work?
Bʀᴏ ᴅᴏ ʏᴏᴜ ᴇᴠᴇɴ Lᴜᴀ? |
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
| |
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
| |
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 21 Aug 2015 03:30 PM |
mhm any time
Bʀᴏ ᴅᴏ ʏᴏᴜ ᴇᴠᴇɴ Lᴜᴀ? |
|
|
| Report Abuse |
|
|