So I need to make a ClickDetector that puts clothes on the person who clicked it. So I was wondering how I would do that. I am sort of good at scripting but not good enough to do this.
✓ ANSWER ACCEPTED
How do I make a ClickDetector put clothes on the person who clicked it?
1 answer
✓ Accepted answer
Here is an example you can use to learn how the MouseClick event works for the ClickDetector
Please click the links above to learn more!
EDIT: Please make sure to put this in a script under game.ServerScriptService
local Part = Instance.new("Part", workspace) -- Create the part
local Clicker = Instance.new("ClickDetector", Part) -- Create the clickdetector
Part.Anchored = true -- anchor the part
local ShirtTexture = "rbxassetid://64803582" -- rbxassetid://(ID) Can get id from roblox shirt page
local PantsTexture = "rbxassetid://34868738"
local function Clicked(Player) -- Function for the MouseClick event
local Character = Player.Character
local Shirt = Character:FindFirstChild("Shirt") -- find the clothing!
local Pants = Character:FindFirstChild("Pants")
if Shirt and Pants then -- Make sure they exist!
Shirt.ShirtTemplate = ShirtTexture -- Set the textures
Pants.PantsTemplate = PantsTexture
end
end
Clicker.MouseClick:Connect(Clicked) -- Execute Clicked(Player) function
3 comments
0
This sorta worked except it took the clothes off my character.
0
and never replaced them with the clothes I wanted. I put in the ID and stuff and put it in the serverscriptservice
0
maybe roblox didnt accept them
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
ClickDetector.MouseClick has one parameter: playerWhoClicked. You would then add an instance of a shirt and parent it to the player's character. Next time please add an attempt