Hi, the intent is to change the model of each player that triggers the proximity prompt, currently it will only allow one and stops working thereafter.
I’ve modified @PseudoPerson’s morph proximity pack to set the players character to a model in server storage opposed to the original which was based on HumanoidDescription.
-- Morph Script
local ProximityPrompts = script["Proximity Prompts"]
local Morph = game.ServerStorage.MorphCharacter:Clone()
local proximityPrompts = {}
local connections = {}
local function getProximityPrompts()
for index, child in pairs(ProximityPrompts:GetChildren()) do
if child:IsA("ObjectValue") then
local prompt = child.Value
if prompt:IsA("ProximityPrompt") then
table.insert(proximityPrompts, prompt)
end
end
end
end
local function onTriggered(player)
local character = player.Character
if character then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
Morph.Name = player.Name
player.Character = Morph
Morph.Parent = workspace
end
end
end
getProximityPrompts()
for index, prompt in ipairs(proximityPrompts) do
local connection = prompt.Triggered:Connect(onTriggered)
table.insert(connections, connection)
end
-- Morph Script
local ProximityPrompts = script["Proximity Prompts"]
local Morph = game.ServerStorage.MorphCharacter:Clone()
local proximityPrompts = {}
local connections = {}
local function getProximityPrompts()
for index, child in pairs(ProximityPrompts:GetChildren()) do
if child:IsA("ObjectValue") then
local prompt = child.Value
if prompt:IsA("ProximityPrompt") then
table.insert(proximityPrompts, prompt)
end
end
end
end
local function onTriggered(player)
local character = player.Character
if character then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
Morph.Name = player.Name
player.Character = Morph
Morph.Parent = workspace
player:LoadCharacter()
end
end
end
getProximityPrompts()
for index, prompt in ipairs(proximityPrompts) do
local connection = prompt.Triggered:Connect(onTriggered)
table.insert(connections, connection)
end
local ProximityPrompts = script["Proximity Prompts"]
local proximityPrompts = {}
local connections = {}
local function getProximityPrompts()
for index, child in pairs(ProximityPrompts:GetChildren()) do
if child:IsA("ObjectValue") then
local prompt = child.Value
if prompt:IsA("ProximityPrompt") then
table.insert(proximityPrompts, prompt)
end
end
end
end
local function onTriggered(player)
local character = player.Character
if character then
local Morph = game.ServerStorage.MorphCharacter:Clone()
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
Morph.Name = player.Name
player.Character = Morph
Morph.Parent = workspace
end
end
end
getProximityPrompts()
for index, prompt in ipairs(proximityPrompts) do
local connection = prompt.Triggered:Connect(onTriggered)
table.insert(connections, connection)
end
The problem is that the Morph variable was outside the Triggered local function, so I put the Morph variable in the Triggered local function and no problem!