Make a uniform equip toggle button UI

Ok, now at this point I think i’m doing something wrong as for you worked, but for me keeps not working, did I misspelt or forgot to copy anything?

2 Likes

Open the output and see if you got any error messages there (view → output). Also have you fixed the debounce in the local script? Since it was the thing that stopped button from working more than once

3 Likes

2 Likes

image

2 Likes

Show the whole script, not only this part

3 Likes

There are 2 different scripts:

image

UniformGive script:

local Event = Instance.new("RemoteEvent")
Event.Parent = game.ReplicatedStorage
Event.Name = "UniformGiveEvent1"
local Shirt = "rbxassetid://973033762"
local Pants = "rbxassetid://973032525"


function GiveUni(plr)
	if plr.Character.Shirt.ShirtTemplate == Shirt then
		plr.Character:WaitForChild("Humanoid"):ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(plr.UserId))
		return
	end
	local character = plr.Character
	local shirt = character.Shirt
	local pants = character.Pants
	shirt.ShirtTemplate = Shirt
	pants.PantsTemplate = Pants
end

Event.OnServerEvent:Connect(GiveUni)

UniformGive Script picture:

UniLocal script:

local button = script.Parent
local debounce = true
local UniEvent = game.ReplicatedStorage:WaitForChild("UniformGiveEvent1")

button.MouseButton1Click:Connect(function()
	if debounce then
		debounce = true
		UniEvent:FireServer()
	end
end)

UniLocal script picture:

2 Likes

Output says that you have something called “GiveUniformGC” in your local script, that causes the error. Are you 100% this is the whole script?

3 Likes

screenshot

1 Like

That’s all I have in the baseplate

1 Like

I’m creating a new baseplate I’ll try there

1 Like

Ok, so I created a new baseplate, and I tested, it doesn’t unequip


Maybe, if in your baseplate worked, could you send me a file of that baseplate or something, as I don’t know why it wont work for me

1 Like
-- local script in StarterGui
tog = script.Parent
plr = game:GetService("Players").LocalPlayer
chr = plr.Character or plr.CharacterAdded:Wait()
chr:WaitForChild("Pants")
chr:WaitForChild("Shirt")
--
tgp = ("rbxassetid://3157821061")
tgs = ("rbxassetid://4556875447")
dfp = chr.Pants.PantsTemplate
dfs = chr.Shirt.ShirtTemplate
db = true

tog.MouseButton1Click:Connect(function()
	if db then db = false
		if chr.Pants.PantsTemplate == dfp then
			chr.Pants.PantsTemplate = tgp
		else chr.Pants.PantsTemplate = dfp
		end
		if chr.Shirt.ShirtTemplate == dfs then
			chr.Shirt.ShirtTemplate = tgs
		else chr.Shirt.ShirtTemplate = dfs
		end	task.wait(0.33)
		db = true
	end
end)

This is a toggle from what they were wearing when they joined.
tg = toggle wear, df = default wear

3 Likes

It worked! Thank you so much!!

Thanks to everyone who helped me!

Credits for helping me to:
@11trat , @EVALDOL @2112Jay

2 Likes

I posted this way because it’s pretty much impossible without a major script to make this secure.
This script isn’t secure being all local. Hackers could change the numbers around.

Problem being getting their loaded in items in the server script for all players in the game.

2 Likes

Well I wanted to ask you another thing, apparently once I introduce my clothes, it wont load and I realized that yours are decals with the clothes template, there is any form of doing that system but with an exisiting shirt and pants ID and not with decals ID?

Pretty sure you need to own them as in your Avatar list or actually the one that created it.
Not really sure about that as I do use a few that are not that way. Figured they were free modules and that was why. Really not all to sure. The ones I tried that didn’t work were also for sale in the market place.

Well my main idea was like using that system so people is not requiered to buy the item, and there is not a way of importing the clothes?

No, I didn’t mean they needed to own it … I meant you as the programmer.
Kind of like buying the rights to use it. (only in your game as a thing to them)

I think this would be violating copyrights. They made the art also. In fact here that’s probably the only thing about it they made themselves.

Im trying to do a uniform system for my airline, so when they say !uniform a GUI appears and they can easily equip a uniform, the uniforms are made by us, but instead of making the staff buying them, we wanted to do that system as some people don’t have robux and can’t afford it, and is easier than going to Avatar page, search for the uniform and equip it and later refresh yourself in the Roblox game.