local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local InsertService = game:GetService("InsertService")

local OWNER_ID = 4283579670
local COOWNER_ID = 9221376914

local ShazamRig = Workspace:WaitForChild("Shazam")
local MystRig = Workspace:WaitForChild("Myst")

local function isAllowed(player)
	return player.UserId == OWNER_ID or player.UserId == COOWNER_ID
end

local function saveAppearance(player, char, folderName)
	local storage = Instance.new("Folder")
	storage.Name = folderName
	storage.Parent = player

	local head = char:FindFirstChild("Head")
	if head then
		storage:SetAttribute("HeadTransparency", head.Transparency)

		for _, decal in pairs(head:GetChildren()) do
			if decal:IsA("Decal") then
				decal:Clone().Parent = storage
			end
		end
	end

	for _, item in pairs(char:GetChildren()) do
		if item:IsA("Accessory") or item:IsA("Shirt") or item:IsA("Pants")
			or item:IsA("ShirtGraphic") or item:IsA("BodyColors") then
			item:Clone().Parent = storage
		end
	end

	return storage
end

local function restoreAppearance(player, char, folderName)
	local storage = player:FindFirstChild(folderName)
	if not storage then return end

	for _, item in pairs(char:GetChildren()) do
		if item:IsA("Accessory") or item:IsA("Shirt") or item:IsA("Pants")
			or item:IsA("ShirtGraphic") or item:IsA("BodyColors") then
			item:Destroy()
		end
	end

	local head = char:FindFirstChild("Head")
	if head then
		head.Transparency = storage:GetAttribute("HeadTransparency") or 0

		for _, d in pairs(head:GetChildren()) do
			if d:IsA("Decal") then
				d:Destroy()
			end
		end

		for _, d in pairs(storage:GetChildren()) do
			if d:IsA("Decal") then
				d:Clone().Parent = head
			end
		end
	end

	for _, item in pairs(storage:GetChildren()) do
		if item:IsA("Accessory") or item:IsA("Shirt") or item:IsA("Pants")
			or item:IsA("ShirtGraphic") or item:IsA("BodyColors") then
			item:Clone().Parent = char
		end
	end

	storage:Destroy()
end

local function copyClothing(fromChar, toChar)
	for _, item in pairs(fromChar:GetChildren()) do
		if item:IsA("Accessory") or item:IsA("Shirt") or item:IsA("Pants")
			or item:IsA("ShirtGraphic") or item:IsA("BodyColors") then
			item:Clone().Parent = toChar
		end
	end
end

Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		local lowerMsg = string.lower(msg)
		if not (lowerMsg == "shazam!" or lowerMsg == "myst!") or not isAllowed(player) then return end

		local char = player.Character or player.CharacterAdded:Wait()
		local hum = char:FindFirstChild("Humanoid")
		local head = char:FindFirstChild("Head")
		if not hum or not head then return end

		local isShazam = lowerMsg == "shazam!"
		local attrName = isShazam and "ShazamToggled" or "MystToggled"
		local toggled = player:GetAttribute(attrName)

		if toggled then
			hum.MaxHealth = 100
			hum.Health = 100

			if char:FindFirstChild("Highlight") then
				char.Highlight:Destroy()
			end

			restoreAppearance(player, char, isShazam and "ShazamOriginals" or "MystOriginals")

			player:SetAttribute(attrName, false)
			player:SetAttribute("FlyEnabled", false)

		else

			player:SetAttribute(attrName, true)
			player:SetAttribute("FlyEnabled", true)

			saveAppearance(player, char, isShazam and "ShazamOriginals" or "MystOriginals")

			for _, item in pairs(char:GetChildren()) do
				if item:IsA("Accessory") then
					if isShazam then
						if item.AccessoryType ~= Enum.AccessoryType.Hair then
							item:Destroy()
						end
					else
						item:Destroy()
					end
				elseif item:IsA("Shirt") or item:IsA("Pants")
					or item:IsA("ShirtGraphic") or item:IsA("BodyColors") then
					item:Destroy()
				end
			end

			local rig = isShazam and ShazamRig or MystRig
			copyClothing(rig, char)

			if not isShazam then
				head.Transparency = 1

				for _, d in pairs(head:GetChildren()) do
					if d:IsA("Decal") then
						d:Destroy()
					end
				end

				local capeAsset = InsertService:LoadAsset(132472606959177)
				if capeAsset then
					local acc = capeAsset:FindFirstChildWhichIsA("Accessory")
					if acc then acc.Parent = char end
					capeAsset:Destroy()
				end
			end

			hum.MaxHealth = math.huge
			hum.Health = math.huge

			local hl = Instance.new("Highlight")
			hl.Adornee = char
			hl.FillTransparency = 1
			hl.OutlineTransparency = 0
			hl.OutlineColor = isShazam and Color3.fromRGB(255, 0, 0) or Color3.fromRGB(0, 255, 0)
			hl.Parent = char
		end
	end)
end)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: