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 5 years ago
Edited 5 years ago

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

local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local Player    = game.Players.LocalPlayer
local Character = Player.Character
local Shirt     = Character:FindFirstChild("Shirt") or Instance.new("Shirt", Character) -- if its in character then get shirt else make a new one
local Pants     = Character:FindFirstChild("Pants") or Instance.new("Pants", Character)

local shirtId   = "https://www.roblox.com/catalog/1303497675/Prison-Prison-Prison-Prison-Prison-Prison-Prison" -- put the shirt id here
local pantsId   = "https://www.roblox.com/catalog/1280655173/Prison-Prison-Prison-Prison-Prison-Prison-Prison" -- put the pants id here

Shirt.ShirtTemplate = "rbxassetid://"..shirtId -- set the shirt
Pants.PantsTempalte = "rbxassetid://"..pantsId -- set the pants
end)

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 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 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:

local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local Player    = player
local Character = char
local Shirt     = Character:FindFirstChild("Shirt") or Instance.new("Shirt", Character) -- if its in character then get shirt else make a new one
local Pants     = Character:FindFirstChild("Pants") or Instance.new("Pants", Character)


Shirt.ShirtTemplate = "rbxassetid://1303497675"
Pants.PantsTemplate = "rbxassetid://1280655173"
end)
end)
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 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 — 5y
0
yeah that doesnt work too... Badgehunter072 0 — 5y

Answer this question