Currently making a GUI to change your character, I want it to be mostly disconnected from the client where it just sends a signal through a RemoteEvent into the server.
To minimize the amount of RemoteEvents in the game, I was planning to only use one to detect the player clicking the button AND the character that's connected to the button... but that would need to pass the character from the client to the server. Which would let a player change what instance is getting passed through to the server... The only way that I can think of that makes it so it doesn't do that, is to create a RemoteEvent for every character that you can change into. Would it be better to do that, or is there a better way to do so? If there is one, please share!!!
#What's a good way of making a Character switcher?
1 messages · Page 1 of 1 (latest)
Who cares what they pass to server as long as it's valid
Just do checks
Are the characters pre-defined? Or do the players make their own custom ones
** You are now Level 9! **
If its the former, you could put all info about your character in the replicatedStorage (or serverStorage if you wanna hide them) and sort them using folders. Something like...
Characters->characterName->shirt,pants,etc
Then, in your ChangeCharacterEvent, you can just ask for the name of the character.
ChangeCharEvent.OnServerInvoke:Connect(function(player: Player, charName: string)
local characterFolder = CharactersFolder:FindFirstChild(charName)
local playerCharacter = player.Character
-- change their character
end)
Ah they're predefined already
They would have to buy the character with ingame money to use it, which is why I dont want it to be on the client
You're overthinking the security aspect. It doesn't matter if the client changes the character in the remote event as long as you check on the server that they own the character. Also, a singular remote event can and should be used for multiple purposes. In this case you only need one remote event, which fires when the client presses the button and passes with it the character that's selected