local function transform(Player, Transforming_Player, mssg, count)
print(Transforming_Player.Name)
print(mssg)
if mssg == "Sphere_Transformation" then
print("count is: " .. count)
if count == 1 then
local spawneffect = game.ReplicatedStorage:WaitForChild("SpawnEffect")
print("mssg is: " .. mssg)
local Sphere_Model = game.Workspace:WaitForChild("Circle")
local SphereClone = Sphere_Model:Clone()
local Animator = Instance.new("Animator", Sphere_Model.Humanoid)
local char = Transforming_Player.Character
SphereClone.Name = Transforming_Player.Name
SphereClone.HumanoidRootPart.CFrame = Transforming_Player.Character.HumanoidRootPart.CFrame
Transforming_Player.Character = SphereClone
SphereClone.Parent = game.Workspace
print("Transformation is done.")
local spawnclone = spawneffect:Clone()
spawnclone.Parent = SphereClone.HumanoidRootPart
spawnclone.CFrame = SphereClone.HumanoidRootPart.CFrame - Vector3.new(0, 4.296, 0)
spawnclone.WeldConstraint.Part0 = SphereClone.HumanoidRootPart
spawnclone.WeldConstraint.Part1 = spawnclone
task.wait(1.5)
SphereClone.HumanoidRootPart:SetNetworkOwner(Transforming_Player)
Transforming_Player:SetAttribute("Transformed", true)
spawnclone:Destroy()
return true, SphereClone, count -- Return the current count
elseif count == 2 then
Transforming_Player:LoadCharacter()
Transforming_Player:SetAttribute("Transformed", false)
count = 0 -- Reset count on the server side
return false, nil, count -- Return the reset count to the client
end
game.ReplicatedStorage.Remotes.TransformationRF.OnServerInvoke = transform
Serverscript
** You are now Level 2! **