How could I make StarterCharacterScripts based on what the player's StarterCharacter is?

How could I make a StarterCharacter have different StarterCharacterScripts based on what their StarterCharacter is? For example How could I make CharacterX have a sprint script but CharacterY not have a sprint script but instead have a crouch script?

you can have both the local script parented to a server script.
Server script:

game.Players.PlayerAdded:Connect(function(plr)
if plr.Character == CharacterX then
script.SprintScript:Clone().Parent = plr.Character
elseif plr.Character == CharacterY then
script.CrouchScript:Clone().Parent = plr.Character
end
end)

Not quite this, I just figured it out using this your script, but I just found a solution. Instead of parenting to character, you parent it to StarterPlayer.StarterCharacterScripts like this,

SERVER SCRIPT

		if chance == 1 then
				character1.Parent = starterPlayer
				character1.Name = "StarterCharacter"
				runScript:Clone().Parent = starterPlayer.StarterCharacterScripts
			elseif chance == 2 then
				character2.Parent = starterPlayer
				character2.Name = "StarterCharacter"
				runScript:Clone().Parent = starterPlayer.StarterCharacterScripts
			elseif chance == 3 then
				character3.Parent = starterPlayer.StarterCharacterScripts
				character3.Name = "StarterCharacter"
				runScript:Clone().Parent = starterPlayer.StarterCharacterScripts
			elseif chance == 4 then
				character4.Parent = starterPlayer
				character4.Name = "StarterCharacter"
				runScript:Clone().Parent = starterPlayer.StarterCharacterScripts
			end
	end
end)```

this is just to further simplify your code:

local models = {character1, character2, character3, character4} -- Stores Character Models

local chance = math.random(1, #models) -- random model based on Amount of Models

local item = models[chance]:Clone() -- Clones a Random Model using math.random
item.Parent = starterPlayer
item.Name = "StarterCharacter" -- names the Model
runScript:Clone().Parent = starterPlayer.StarterCharacterScripts

You dont need to have Multiple elseif statements for a singular item, instead you can just make this work for multiple items.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.