hello, or even hello again for some I'm still a beginner for the LUA script, I know a few tricks but I don't know how to do it, so I'm here to ask you for a little help.
01 | local function ChangeClothes(char, shirtid, pantsid) |
02 | local shirt = char:FindFirstChildOfClass "Shirt" or Instance.new( "Shirt" , char) |
03 | local pants = char:FindFirstChildOfClass "Pants" or Instance.new( "Pants" , char) |
04 | shirt.ShirtTemplate = shirtid |
05 | pants.PantsTemplate = pantsid |
06 | end |
07 |
08 | local remote = game.ReplicatedStorage.TeamChange |
09 | LVL 2 = game.ReplicatedStorage [ "[SCP] Card-L2" ] |
10 | LVL 4 = game.ReplicatedStorage [ "[SCP] Card-L4" ] |
11 | LVL 3 = game.ReplicatedStorage [ "[SCP] Card-L3" ] |
12 | Flashlight = game.ReplicatedStorage.Flashlight |
13 |
14 |
15 | function remote.OnServerInvoke(player, TeamName) |
I had already asked for the change of clothes but it was only just after I realized that I had to wear hats. lol
thanks you :)
01 | function REMOVE_HATS() |
02 | for _, v in pairs (char:GetChildren()) do |
03 | if v:IsA( 'Accessory' ) then |
04 | v:Destroy() |
05 | end |
06 | end |
07 | end |
08 |
09 | local InsertService = game:GetService( 'InsertService' ) |
10 |
11 | function INSERT_HAT(hatid) |
12 | local model = InsertService:LoadAssest(hatid) |
13 |
14 | for _, v in pairs (model:GetChildren()) do |
15 | if v:IsA( 'Accessory' ) then |
16 | v.Parent = char |
17 | model:Destroy() -- destroy model container |
18 | end |
19 | end |
20 | end |
Do this: char.Humanoid:RemoveAccessories()
For the adding accessories, use char.Humanoid:AddAccessory()
I presume you would have to format it like this:
01 | local NewAccessory = Instance.new( "Accessory" ) |
02 | local Handle = Instance.new( "Part" ) -- create the visible hat |
03 | Handle.Name = "Handle" -- REQUIRED |
04 | Handle.Parent = NewAccessory |
05 | local Mesh = Instance.new( "Mesh" ) -- If you're not making a brick hat |
06 | -- Mesh.Texture = (whichever) |
07 | Mesh.Parent = Handle |
08 | local Attachment = Instance.new( "Attachment" ) |
09 | Attachment.Parent = Handle -- and so forth |
10 | local Weld = Instance.new( "ManualWeld" ) |
11 | Weld.Part 0 = Handle |
12 | -- Weld.Part1 == blank |
13 | Weld.Parent = Handle |
14 | -- And so forth on |
15 | char.Humanoid:AddAccessory(NewAccessory) |
If they don't work, then my apologies; I never actually have used this code before.
I don't know what to do anymore, here is the whole script, basically what I want to do is that as soon as the player joins the team, all his hats are removed and a hat with the meshid "http://www.roblox.com/asset/?id=112643970" and the texture "http://www.roblox.com/asset/?id=112644004" I've never written this kind of thing yet (it's the beginning) sorry for bad english ^^ (french)
01 | local function ChangeClothes(char, shirtid, pantsid) |
02 | local shirt = char:FindFirstChildOfClass "Shirt" or Instance.new( "Shirt" , char) |
03 | local pants = char:FindFirstChildOfClass "Pants" or Instance.new( "Pants" , char) |
04 | shirt.ShirtTemplate = shirtid |
05 | pants.PantsTemplate = pantsid |
06 | end |
07 |
08 | local remote = game.ReplicatedStorage.TeamChange |
09 | LVL 2 = game.ReplicatedStorage [ "[SCP] Card-L2" ] |
10 | LVL 4 = game.ReplicatedStorage [ "[SCP] Card-L4" ] |
11 | LVL 3 = game.ReplicatedStorage [ "[SCP] Card-L3" ] |
12 | Flashlight = game.ReplicatedStorage.Flashlight |
13 |
14 |
15 | function remote.OnServerInvoke(player, TeamName) |