local ChangerPart = script.Parent
local OutfitChanger = ChangerPart.Parent
local ShirtTemplate = OutfitChanger.Shirt.ShirtTemplate
local PantsTemplate = OutfitChanger.Pants.PantsTemplate
ChangerPart.Touched:Connect(function(TouchPart, plr)
if plr:GetRankInGroup(11679839) < 6 then return end
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, GamePass) then return end
if TouchPart and TouchPart.Parent and TouchPart.Parent:FindFirstChild("Humanoid") then
print("Player Got Uniform")
local Character = TouchPart.Parent
Character.Shirt.ShirtTemplate = ShirtTemplate
Character.Pants.PantsTemplate = PantsTemplate
end
end)
local ChangerPart = script.Parent
local OutfitChanger = ChangerPart.Parent
local ShirtTemplate = OutfitChanger.Shirt.ShirtTemplate
local PantsTemplate = OutfitChanger.Pants.PantsTemplate
local MPS = game:GetService("MarketplaceService")
local GamePassID = 0000000
ChangerPart.Touched:Connect(function(Object)
if Object.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(Object.Parent)
if plr then
if plr:GetRankInGroup(11679839) then return end
--Using Pcalls() to avoid problems.
local success, result = pcall(MPS:UserOwnsGamePassAsync(plr.UserId,GamePassID))
if success then
if result then
local Character = Object.Parent
Character.Shirt.ShirtTemplate = ShirtTemplate
Character.Pants.PantsTemplate = PantsTemplate
end
end
end
end
end)
local ChangerPart = script.Parent
local ShirtTemplate = "rbxassetid://1210857662"
local PantsTemplate = "rbxassetid://1210858279"
local MPS = game:GetService("MarketplaceService")
local GamePassID = 15447425
ChangerPart.Touched:Connect(function(Object)
if Object.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(Object.Parent)
if plr then
if plr:GetRankInGroup(9854805) > 6 then return end
--Using Pcalls() to avoid problems.
local success, result = pcall(function()
if MPS:UserOwnsGamePassAsync(plr.UserId,GamePassID) then
Object.Parent.Shirt.ShirtTemplate = ShirtTemplate
Object.Parent.Pants.PantsTemplate = PantsTemplate
end
end)
end
end
end)
>= means more or equal to. <= means less or equal to. == means equal to. ~= means not equal to.
Now with this in mind, you can use this script with the following key above to change the script:
local ChangerPart = script.Parent
local OutfitChanger = ChangerPart.Parent
local ShirtTemplate = OutfitChanger.Shirt.ShirtTemplate
local PantsTemplate = OutfitChanger.Pants.PantsTemplate
ChangerPart.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if not Player then return end
if not Player:GetRankInGroup(11679839) >= 6 then return end
if not game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, GamePass) then return end
print(Player.Name.." Got The Uniform")
local Character = Player.Character
Character.Shirt.ShirtTemplate = ShirtTemplate
Character.Pants.PantsTemplate = PantsTemplate
end)
Hopefully, this helped you learn a thing or two! Make sure to mark me (or anyone) as the solution to assist the SEO!
local ChangerPart = script.Parent
local ShirtTemplate = "rbxassetid://1210857662"
local PantsTemplate = "rbxassetid://1210858279"
local MPS = game:GetService("MarketplaceService")
local GamePassID = 15447425
ChangerPart.Touched:Connect(function(Object)
if Object.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(Object.Parent)
if plr then
if plr:GetRankInGroup(9854805) >= 6 then return end
--Using Pcalls() to avoid problems.
local success, result = pcall(function()
if MPS:UserOwnsGamePassAsync(plr.UserId,GamePassID) then
Object.Parent.Shirt.ShirtTemplate = ShirtTemplate
Object.Parent.Pants.PantsTemplate = PantsTemplate
end
end)
end
end
end)
also check if the player’s character has a shirt and pants
I believe that some players do not wear this clothings and it would not add to the player’s character ingame
try
local Marketplace = game:GetService("MarketplaceService")
local ChangerPart = script.Parent
local OutfitChanger = ChangerPart.Parent
local OriginShirt = OutfitChanger.Shirt
local OriginPants = OutfitChanger.Pants
local GroupId = 000000
local GamePassId = 000000
ChangerPart.Touched:Connect(function(Object)
local Player = game.Players:GetPlayerFromCharacter(Object.Parent)
if not Player then return end
local Result, Config = pcall(function()
if Player:GetRankInGroup(GroupId) < 6
and not Marketplace:UserOwnsGamePassAsync(Player.UserId, GamePassId)
then return false
end
return true
end)
if not Result then
warn("Something Went Wrong")
elseif Config then
local Character = Object.Parent
local Shirt = Character:FindFirstChildWhichIsA("Shirt")
local Pants = Character:FindFirstChildWhichIsA("Pants")
if Shirt then
Shirt.ShirtTemplate = OriginShirt.ShirtTemplate
else
local NewShirt = OriginShirt:Clone()
NewShirt.Parent = Character
end
if Pants then
Pants.PantsTemplate = OriginPants.PantsTemplate
else
local NewPants = OriginPants:Clone()
NewPants.Parent = Character
end
else
print("Player Rank In Group Is Not 6+ Or Player Do Not Have The Gamepass")
end
end)