Hello developers!
I would like help with a script i am currenctly making, please help!
- What do you want to achieve? Keep it simple and clear!
I would like to achieve that when the player spawns/reset, a script will replace their model with a skin.
- What is the issue? Include screenshots / videos if possible!
The issue is, everything works fine it knows what skin to choose but it gives me a error
Workspace.masterminyxs.Script:8: attempt to index nil with 'StarterCharacter'

- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Nope, i’ve tried to rescript it in a way but it couldn’t do anything, and as for devforum i couldn’t find anything.
This is the script from the code, if anybody finds something odd or knows the reason, please tell!
local db = true
if db == true then
db = false
local hit = script.Parent
local plr = game.Players:GetPlayerFromCharacter(hit)
local skin = plr:FindFirstChild("SelectedSkin"):FindFirstChild("YourSkin")
local orign = game.ServerStorage.Skins:FindFirstChild(skin.Value)
local model = orign.StarterCharacter
local oldModel = plr.Character
local newModel = model:Clone()
local oldCFrame = oldModel:GetPrimaryPartCFrame()
plr.Character = newModel
newModel.Parent = workspace -- [1] this follows current character loading behavior
newModel:SetPrimaryPartCFrame(oldCFrame)
newModel.Animate.Disabled = true
newModel.Animate.Disabled = false
end
This script is a normal script located in StarterCharacterScripts