-
What do you want to achieve? A character selection screen.
-
What is the issue? I have a code that works, but it has recently come to my attention that the script is only client side, meaning that no one else sees the new character aside from the client itself.
-
What solutions have you tried so far? I’ve tried having remote events fire to the server that should have handled the character changing but it has either killed the character or made the camera stuck in the character selection area without the new character even spawning.
here’s the character setting script (local script under the button):
local Button = script.Parent.ImageButton
local player = game.Players.LocalPlayer
local replicatedStorage = game:GetService("ReplicatedStorage")
local SetSubject = replicatedStorage.CharacterSelection.SetSubject
local CharacterGUI = script.Parent.Parent.Parent
Button.MouseButton1Down:Connect(function()
CharacterGUI.Enabled = false
local ChosenCharacter = replicatedStorage.CharacterSelection.Characters.Daisy:Clone()
ChosenCharacter.Humanoid.DisplayName = " "
local CurrentCharacter = player.Character
local LocalScripts = {}
CurrentCharacter.Health:Clone().Parent = ChosenCharacter
table.insert(LocalScripts,CurrentCharacter.Animate:Clone())
ChosenCharacter.Parent = workspace
player.Character = ChosenCharacter
for index2,item2 in pairs(LocalScripts) do
item2.Parent = ChosenCharacter
end
ChosenCharacter.Humanoid.DisplayName = " "
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
workspace.CurrentCamera.CameraSubject = ChosenCharacter.Humanoid
ChosenCharacter.Humanoid.Died:Connect(function()
SetSubject:FireServer()
task.wait(2)
ChosenCharacter:Destroy()
end)
end)
all help would be appreciated