Hello everyone!
Right now I’m trying to make a system that gives you an R15 morph that retains after death, and is unique to your player.
I’m trying to make this be called through a RemoteEvent so I can morph the player when they click a UI, but right now I’m having an issue where every single player will get the same morph.
I’ll supply both scripts so I can try get more help, if needed I’ll also send the RBXL file.
– SERVER SCRIPT –
local RemoteEvent1 = game.ReplicatedStorage.MorphRemotes.Civilian:WaitForChild("SwitchCharacterCiv")
local RemoteEvent2 = game.ReplicatedStorage.MorphRemotes["The Combine"]:WaitForChild("i5")
RemoteEvent1.OnServerEvent:Connect(function(player)
local CharacterStorage = game.ReplicatedStorage.Characters
local CharacterValue = "Civilian"
local characterModel = CharacterStorage:FindFirstChild(CharacterValue)
if not characterModel then
warn("Character model not found for value:", CharacterValue)
return
end
local clone = characterModel:Clone()
clone.Name = "StarterCharacter"
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.Health = 0
else
warn("Humanoid not found in character.")
end
clone.Parent = game.StarterPlayer
player:LoadCharacter()
end)
RemoteEvent2.OnServerEvent:Connect(function(player)
local CharacterStorage = game.ReplicatedStorage.Characters
local CharacterValue = "i5"
local characterModel = CharacterStorage:FindFirstChild(CharacterValue)
if not characterModel then
warn("Character model not found for value:", CharacterValue)
return
end
local clone = characterModel:Clone()
clone.Name = "StarterCharacter"
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.Health = 0
else
warn("Humanoid not found in character.")
end
clone.Parent = game.StarterPlayer
player:LoadCharacter()
end)
– LOCAL SCRIPT –
local plr = game:GetService("Players").LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local humanoid = character:FindFirstChild("Humanoid")
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.MorphRemotes.Civilian.SwitchCharacterCiv:FireServer()
end)```