Hey, I've only been using Roblox Studio for 2 days, and if I do say so myself, I am pretty quick at learning it. However for a game I am developing, I require a change of costume part of the way through.
Information on the game: Game style: Explore a World/Map Max player count: 60 (not sure how useful that info is)
Specifics on question: I am designing a room that has "Bio-Hazardous" fog, meaning they have to wear Hazmat suits, I already have an idea on the Costume parts (Top: 4427772288 Trousers/pants: 1273401468 Hood/accessory: 4753158721 Facemask/accessory: 4708697945) - if anybody knows of a better combo, please let me know.
The change of clothes will be achieved by passing through an invisible block (Anchored ticked, CanCollide unticked, transparency 1) that will be on the inside of the doorway, and when they leave, the player will pass through another one that will revert their character.
I have looked up many tutorials, and found different codes that work for some parts, yet not others. I believe the main issue is to do with finding the .LocalPlayer
here are some examples of the code I have tried
This was the shortest but most confusing:
local Part = script.Parent
local Debounce = false
Part.Touched:Connect(function(Hit)
if not Debounce then
if Hit.Name == "Humanoid" then
Debounce = true
--do something
print('Hit successfull')
end
end
end)
Part.TouchEnded:Connect(function(Hit)
if Debounce then
if Hit.Name == "Humanoid" then
Debounce = false
--do something
print('Hit still successful')
end
end
end)
This was taken from a YouTube video that was made in 2016 when remove was still an option
script.Parent.Touched:Connect(function(hit)
if (hit.Parent:FindFirstChild("Huminoid"))then
local plr = game.Players.FindFirstChild(hit.Parent.Name)
local plrPants = hit.Parent.FindFirstChild("Pants")
if (plrPants)then
part.Destroy()
end
local plrShirt = hit.Parent.FindFirstChild("Shirt")
if (plrShirt)then
part.Destroy()
end
local newclothingpants = "rbxassetid://1273401468"
local newclothingshirt = "rbxassetid://4427772288"
newclothingpants.Parent = hit.Parent
newclothingshirt.Parent = hit.Parent
end
end)
This final one was an edit from a similar article on this website, however caused the most error messages
local Players = game:GetService("Players")
local player = Players.LocalPlayer
print('Is this working')
local PlayerHazmatClothingShirt = 4427772288 -- Put Shirt ID here
local PlayerHazmatClothingPants = 1273401468 -- Put Pants ID here
local function Parent.Parent.ClothesChanger.Touched:Connect(function(hit)
print('Hit successfull')
if game.Players.LocalPlayer.Character:FindFirstChild("Shirt") then
game.Players.LocalPlayer.Character.Shirt:Destroy()
end
if game.Players.LocalPlayer.Character:FindFirstChild("Shirt Graphic") then
game.Players.LocalPlayer.Character:FindFirstChild('Shirt Graphic'):Destroy()
end
if game.Players.LocalPlayer.Character:FindFirstChild("Pants") then
game.Players.LocalPlayer.Character.Pants:Destroy()
end
print('destroy successful')
local newShirt = Instance.new('Shirt',game.Players.LocalPlayer.Character)
local newPants = Instance.new('Pants',game.Players.LocalPlayer.Character)
newShirt.ShirtTemplate = "rbxassetid://"..tostring(PlayerHazmatClothingShirt-1) -- tostring converts the number into text.
newPants.PantsTemplate = "rbxassetid://"..tostring(PlayerHazmatClothingPants-1)
print('load successfull')
wait(3)
end
end)
If anybody knows how to do this it would be a great help
[Other info:] Script is in a model "HazmatCostume" that also includes part "ClothesChanger" and "ClothesReverter"
All objects have Archivable ticked if that helps.
I have tested using the Play here button in Roblox Studio and also the Start server option, however they both come up with the same errors/issues
Apologies I haven't been able to place any screenshots as I don't actually know how to.

1 comment
you can use this for the screenshots and put the link to the screenshot/video (it also does videos!) though there might be a better option so research into it (link https://gyazo.com/ sorry if you cant download it!)