Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I force a player to wear a certain clothing when he joins? (my script doesnt work)

Asked by 6 years ago
Edited 6 years ago

Someone please help me I dont know why this script doesnt work

01local Players = game:GetService("Players")
02Players.PlayerAdded:Connect(function(player)
03local Player    = game.Players.LocalPlayer
04local Character = Player.Character
05local Shirt     = Character:FindFirstChild("Shirt") or Instance.new("Shirt", Character) -- if its in character then get shirt else make a new one
06local Pants     = Character:FindFirstChild("Pants") or Instance.new("Pants", Character)
07 
10 
11Shirt.ShirtTemplate = "rbxassetid://"..shirtId -- set the shirt
12Pants.PantsTempalte = "rbxassetid://"..pantsId -- set the pants
13end)

Please help Ive also tried only putting the ID onstead of the full link but it still doesnt work!

0
you misspelled "PantsTemplate" GoldAngelInDisguise 297 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

I see your problem. Your basically adding the whole roblox link onto the shirts template, instead of just the number. You should have also used a character added script. You can't use local player on a server script. Put this script in server script service. Here is your fixed script:

01local Players = game:GetService("Players")
02Players.PlayerAdded:Connect(function(player)
03player.CharacterAdded:Connect(function(char)
04local Player    = player
05local Character = char
06local Shirt     = Character:FindFirstChild("Shirt") or Instance.new("Shirt", Character) -- if its in character then get shirt else make a new one
07local Pants     = Character:FindFirstChild("Pants") or Instance.new("Pants", Character)
08 
09 
10Shirt.ShirtTemplate = "rbxassetid://1303497675"
11Pants.PantsTemplate = "rbxassetid://1280655173"
12end)
13end)
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

In fact i used a local script and i also tried not adding the whole thing i guess the problem was the fact that the script wasnt character added but thanks! Edit: there is a problem, there is no such thing as a server script storage

0
O sorry, i ment server script service. CaptainD_veloper 290 — 6y
0
yeah that doesnt work too... Badgehunter072 0 — 6y

Answer this question