Morph applies to all players

portion of server side script

FelineParent = script.Parent

-- MORPH --

game.Players.PlayerAdded:Connect(function(plr)
	game.ReplicatedStorage.MorphEvent.OnServerEvent:connect(function(plr)
		local oldCharacter = plr.Character
		local newCharacter = FelineParent.Feline:Clone()

		newCharacter.HumanoidRootPart.Anchored = false
		newCharacter:SetPrimaryPartCFrame(oldCharacter.PrimaryPart.CFrame)

		plr.Character = newCharacter
		newCharacter.Parent = workspace
	end)
end)

local script (in textbutton)

local ReplicatedStorage = game:GetService("ReplicatedStorage")

script.Parent.MouseButton1Click:Connect(function()
	ReplicatedStorage.MorphEvent:FireServer()
end)
1 Like

Why are you connecting the .OnServerEvent every time a player joins? Probably what’s causing your bug.

Code:

FelineParent = script.Parent

-- MORPH --

game.ReplicatedStorage.MorphEvent.OnServerEvent:connect(function(plr)
	local oldCharacter = plr.Character
	local newCharacter = FelineParent.Feline:Clone()

	newCharacter.HumanoidRootPart.Anchored = false
	newCharacter:SetPrimaryPartCFrame(oldCharacter.PrimaryPart.CFrame)

	plr.Character = newCharacter
	newCharacter.Parent = workspace
end)
2 Likes

My mistake, I was under the impression that was needed for the game to identify the player. Apparently not.

2 Likes

It does. .OnServerEvent already identifies the player though.

2 Likes

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