I’ve noticed when I was making my Morph Menu, on Studio, the models would appear in the preview fine, like this:
However, in the actual Roblox Game, the model would not appear.
This was weird to me especially because it sometimes WOULD appear in game, and then sometimes not, and I don’t know what’s working and what isn’t. I’m reusing a part of my script from another script that grabs the Monster that is selected and spawns it.
I’ve noticed when switching between the different options, I’d get DataStore warnings, which I’m not sure if that’d be the culprit or not.
Here is the code for the script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local morphMenu = playerGui:WaitForChild("ScreenGui"):WaitForChild("MorphMenu")
local selectedMonster = player:WaitForChild("SelectedMonster")
local selectedSurvivor = player:WaitForChild("SelectedSurvivor")
local monstersFolder = ReplicatedStorage:WaitForChild("Monsters")
local survivorsFolder = ReplicatedStorage:WaitForChild("Survivors")
local changeMonsterEvent = ReplicatedStorage:WaitForChild("ChangeMonster")
local abominationButton = morphMenu:WaitForChild("AbominationButton")
local imitheosButton = morphMenu:WaitForChild("ImitheosButton")
local elvebeistButton = morphMenu:WaitForChild("ElvebeistButton")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local gui = player:WaitForChild("PlayerGui")
local monsterinventoryspawn = workspace.InventoryArea.monsterInventorySpawn
task.wait(0.01)
local function updateSelectedMonster(newSelection)
if not newSelection then return end
changeMonsterEvent:FireServer(newSelection)
end
abominationButton.MouseButton1Click:Connect(function()
updateSelectedMonster("Abomination")
end)
imitheosButton.MouseButton1Click:Connect(function()
updateSelectedMonster("Imitheos")
end)
elvebeistButton.MouseButton1Click:Connect(function()
updateSelectedMonster("Elvebeist")
end)
local selectedMonsterValue = player:WaitForChild("SelectedMonster")
selectedMonsterValue:GetPropertyChangedSignal("Value"):Connect(function()
local newSelection = selectedMonsterValue.Value
local model = monstersFolder:FindFirstChild(newSelection)
local clonedModel = nil
if model then
clonedModel = model:Clone()
clonedModel:SetPrimaryPartCFrame(monsterinventoryspawn.CFrame)
clonedModel.HumanoidRootPart.Anchored = false
monsterinventoryspawn:ClearAllChildren()
clonedModel.Parent = workspace.InventoryArea.monsterInventorySpawn
local animator = clonedModel:WaitForChild("Humanoid"):WaitForChild("Animator")
if animator then
local track = animator:LoadAnimation(clonedModel:WaitForChild("Animate"):WaitForChild("idle"):WaitForChild("Animation1"))
track.Looped = true
track:Play()
end
else
warn("Model not found in ReplicatedStorage/Monsters: " .. newSelection)
end
end)
Does anyone know what might be causing this? Please help!! Thank you!!