I have several morphs in my game and if you step on a part, you'll turn into that morph and a custom gui will show up for whichever character you choose. However, this only works one time. If you restart/die and pick a character again then the Gui wont show up at all. I'm using FilteringEnabled and I'm not getting any error messages.
local menu = script.Parent.CharacterGui
local function onTouched(hit)
if (game.Players:GetPlayerFromCharacter(hit.Parent)) then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not player.PlayerGui:findFirstChild("CharacterGui") then
menu:Clone().Parent = player.PlayerGui
wait()
end
end
end
script.Parent.Touched:connect(onTouched)
In studio mode, this script works 100% of the time so I can't figure out what the problem is.

1 comment
The Gui is in the part that you touch. I want it to transfer to the PlayerGui.