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 the code:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvent = Instance.new("RemoteEvent", ReplicatedStorage) RemoteEvent.Name = "CharSwap" local function onClicked() script["Click Sound"]:Play() local StarterChar = game.StarterPlayer.StarterCharacter StarterChar:Destroy() local ReplicatedStorage = game:GetService("ReplicatedStorage") RemoteEvent:FireServer()local James = ReplicatedStorage["James"]:Clone() James.Name = ("StarterCharacter") James.Parent = game.StarterPlayer end RemoteEvent:FireServer(onClicked)