I am trying to pull the StarterCharacter from replicated storage and place it into my StarterPlayer to Change the character.
So, When I click my GUI button I get this in my output log: Players.simcity99.PlayerGui.ScreenGui.Buttons.James.Script:16: attempt to index a nil value.
I am assuming I messed up the remote event.
Here is code:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = Instance.new("RemoteEvent", ReplicatedStorage)
createPartEvent.Name = "CharSwap"
local function onClicked()
script["Click Sound"]:Play()
local StarterChar = game.StarterPlayer.StarterCharacter
StarterChar:Destroy()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local James = ReplicatedStorage["James"]:Clone()
James.Name = ("StarterCharacter")
end
onClicked().OnServerEvent:Connect(onClicked)
Where did I mess up?

2 comments
idk i had the same thing but i had to kill the player for it to take effect, mabye put the script in replicated first? idk if that will do anything
I will try that out