Morphing with values

I want to make the player morph into a different character when a value is a certain value I’ve tried replacing the player.Character with the simple code
player.Character = InsertModelNameHere
but it isn’t really working because 1. The camera doesn’t follow the player and 2. I want other players to be able to morph into the same model aswell.
here is an example of a script I have tried before
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character)added wait(3) player. Character = InsertModelNameHere end) end)

1 Like

Not sure why you added lua but heres a morph code

local ModelToMorph = game:GetService("ServerStorage").ModelToMorph -- Model that player will morph into

game:GetService("Players").PlayerAdded:Connect(function(player)

local Morph = ModelToMorph:Clone() -- Clones the morph
Morph.Name = player.Name -- Names it after the character (basically what the default character does too)
Morph.Parent = workspace -- not 100% sure if thats needed
player.Character = Morph -- Sets the players character to the cloned morph

end)
1 Like

The lua is something I copy and pasted from the base roblox scripting support text. Also thank you for the script.

I put the script into ServerScriptService and edited it to work with my model
local TrollFolder = game:GetService(“ServerStorage”).Trolls – Model that player will morph into
local SS = game:GetService(“ServerStorage”)
if SS.Troll.Value == 1 then
game:GetService(“Players”).PlayerAdded:Connect(function(player)

	local Morph = TrollFolder.Troll:Clone()
	Morph.Name = player.Name
	Morph.Parent = workspace
	player.Character = Morph

end) -- pretend another end below this one

However, the player is not morphing into the example model

Where is the value stored, and why are you running it when players join?

If I’m gonna be honest I am very new to morphing scripts, also the dev forum messed up how the script is showing. also, the value is stored in ServerStorage.

Okay try this
This will morph all players when the value is changed to true

local SS = game:GetService("ServerStorage")
local TrollFolder = SS.Trolls
local TrollVal = SS.Troll

TrollVal.Changed:Connect(function()

	if TrollVal.Value == true then

		print("Value true! \nMorphing players...")
		for _, player in pairs(game.Players:GetChildren()) do

			local morph = TrollFolder.Troll:Clone()
			local position = player.Character:GetPrimaryPartCFrame()
			morph.Name = player.Name
			player.Character = morph

			morph.Parent = game.Workspace
			morph:SetPrimaryPartCFrame(position)

		end

	else

		print("Value false!")

	end

end)

Better to do pairs(game.Player:GetPlayers()).

True, I made that in a little of a rush lol… Thank you for pointing that out

1 Like

We have a slight problem there is an error which is giving me the text
“Player is not a valid member of DataModel GameNameHere”

Wait so when the value becomes a certain value do you want all the players in the game to morph into a different character? Or is that value a descendent of a specific player, and you want only that player to change?

You need to change the camera’s subject to the new character model’s ‘Humanoid’ instance.

Camera.CameraSubject = NewHumanoid --Reference to new character model's humanoid.

I basically want it to be for a specific player but any player can morph, a great example would be ABA because in ABA if you have a certain character (which I’m guessing is a character value) it will morph you into the character.