I had this brainwave of an idea for my game. Basically its a railway game but this idea was you can choose what you want to be. Driver, Dispatcher, Guard or just a normal player. The Driver, Dispatcher and Guard would get given their respective uniforms, as shown below.
Here’s my regular outfit. I need to workout a way to give back their original clothes and remove the given outfits. Anyone have any ideas? I’ve searched through this forum and scriptinghelpers and I cannot find anything.
There is actually a fairly simple way of doing this; though it has a few variations on it’s execution.
I’d personally recommend just using 2 string values to store the shirt and pants ids of the players whenever they change outfits, this way you can easily reset them; you could also just store them when the player joins and not set them afterwards.
I actually find this confusing to use. It has to fit into a RemoteEvent script (on the server side) and I’m finding it difficult because of where to exactly put them.
Because of where I put it, every time the remoteevent is fired for the user the shirt and pants template would be the ones they are wearing, not the original ones. How can I bypass this?
-- local script inside of starterpack/startergui (wherever you keep the local script for remote events)
game.Players.CharacterAdded:Connect(function(char)
if char then
shirtid = game.Players.LocalPlayer.Character.Shirt.ShirtTemplate
pantsid = game.Players.LocalPlayer.Character.Pants.PantsTemplate
end
Ah, I must’ve been mistaken and assumed you were using :FireServer() as opposed to :FireClient, my mistake. I don’t see why you’d use a serverscript to change the shirt/pants id of a player as any changes made locally to the player are actually viewable to all.
Also a quick note: “game.Players.CharacterAdded” should be “game.Players.LocalPlayer.CharacterAdded”
You could just carry out everything in a local script, at least that’d be the easiest way in my opinion.
Unless it was patched recently (which I don’t believe it was since as far as I am aware it was an intentional feature), any changes made from the client towards that players avatar will replicate to the server. That’s why things like TP exploits work.
I assumed you had team spawns put in place but you could log the player’s cloth ids ONCE he/she enters the game. Then you can use them in deleting the roles
Pretty sure I included game.Players.LocalPlayer.CharacterAdded as a method that would leave you with no reason to use LoadCharacter() or a server script at all. You don’t need to over complicate things; just use a local script and the method I provided which should work quite flawlessly.