Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Only one player can morph and when you reset you can not morph anymore, what is the fix for this?

As this title implies, once one player morphs no one else can morph and once that player resets they also will not get the morph anymore.

local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local PlayBtn = game:GetService("StarterGui").ScreenGui.MainFrame.Confirm
local ChangeLoadout = ReplicatedStorage:WaitForChild("GiveLoadout")
local charactermodels = ServerStorage.CharacterModels




ChangeLoadout.OnServerEvent:Connect(function(player)
	local morph = player.Loadouts.loadout.Value
	local morphchosen = ServerStorage.CharacterModels:WaitForChild(morph)
	local morphname = morphchosen.Name
	if morph == morphname then
		morphchosen:PivotTo(player.Character:GetPivot())
		player.Character = morphchosen
		morphchosen.Parent = workspace
	end
end)

1 answer

Hello, thomas666666666666!

The problem with your code is that you are moving the morph you have in server storage to the player's character, you just need to clone it before doing it.

local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local PlayBtn = game:GetService("StarterGui").ScreenGui.MainFrame.Confirm
local ChangeLoadout = ReplicatedStorage:WaitForChild("GiveLoadout")
local charactermodels = ServerStorage.CharacterModels




ChangeLoadout.OnServerEvent:Connect(function(player)
    local morph = player.Loadouts.loadout.Value
    local morphchosen = ServerStorage.CharacterModels:WaitForChild(morph)
    local morphname = morphchosen.Name
    if morph == morphname then
        local morphClone = morphchosen:Clone()
        morphClone :PivotTo(player.Character:GetPivot())
        player.Character = morphClone 
        morphClone .Parent = workspace
    end
end)

If this answers your question, please don't forget to mark it as the "Accepted Answer"

This discussion is preserved as it was. New answers, comments, and votes are closed.