Ok.
So.
The point of the script is to make you turn invisible part by part and then teleport to the destination part, and then make you turn visible and you can then just move around like normal.
But somehow, when you touch the part, it will make you disappear, and then reappear but no teleport.
Sometimes it works but not always. It mainly doesn't more than it should too.
Here's the script.
--Virtualization Script v1.9
--Faster virtualizations
--Scanner less likely to get bork'd
--Randomly chooses between multiple VirtualizationPoints
Scanner = script.Parent.Parent.Parent
ScannerDebounce = true
VirtualizationFailed = false
function RemoveMessage()
m:Remove()
end
function CreateMessage(messageText, waitDuration)
m = Instance.new("Message")
m.Text = messageText
m.Parent = game.Players:findFirstChild(Lyokon.Name)
delay(waitDuration, RemoveMessage)
end
function FailedToVirtualize()
VirtualizationFailed = true
CreateMessage("Failed to virtualize!", 1)
print("Error in virtualization!")
wait(3)
script.Parent.BrickColor = BrickColor.new("Bright red")
Scanner.ScannerDoor.CanCollide = false
Scanner.ScannerDoor.Transparency = 1
ScannerDebounce = true
print("Scanner reset.")
end
function RandomTeleport()
p = math.random(1, 2) --Change '2' to the number of VirtualizationPoints in this Scanner model.
if (p == 1) then Lyokon:findFirstChild("Torso").CFrame = Scanner.VirtualizationPoint1.CFrame
elseif (p == 2) then Lyokon:findFirstChild("Torso").CFrame = Scanner.VirtualizationPoint2.CFrame --Copy this line for each new VirtualizationPoint. Change the number suffix.
end
end
function GoToLyoko(hit)
print("In function GoToLyoko")
print(ScannerDebounce)
if (ScannerDebounce == false) then return end
if (hit.Parent:findFirstChild("Torso") ~= nil) then
ScannerDebounce = false
script.Parent.BrickColor = BrickColor.new("Bright green")
Lyokon = hit.Parent
--Fail check 1
if (Lyokon.Humanoid.Health == 0 and Lyokon.Humanoid.MaxHealth > 0) then FailedToVirtualize() end
if (VirtualizationFailed == false) then
print("Humanoid in Scanner. Virtualizing...")
wait(0.3)
--Close the Scanner Door
CreateMessage("Transfer ".. Lyokon.Name .."...", 1)
Scanner.ScannerDoor.CanCollide = true
Scanner.ScannerDoor.Transparency = 0
print("Scanner closed.")
wait(1.5)
CreateMessage("Scanner ".. Lyokon.Name .."...", 1.5)
--The below section will be obsolete'd in Virtualzation Script v2
--=========================================================
Lyokon:findFirstChild("Head").Reflectance = 1
Lyokon:findFirstChild("Head").Transparency = 1
wait(0.5)
Lyokon:findFirstChild("Left Arm").Reflectance = 1
Lyokon:findFirstChild("Left Arm").Transparency = 1
Lyokon:findFirstChild("Right Arm").Reflectance = 1
Lyokon:findFirstChild("Right Arm").Transparency = 1
Lyokon:findFirstChild("Torso").Reflectance = 1
Lyokon:findFirstChild("Torso").Transparency = 1
wait(0.5)
Lyokon:findFirstChild("Left Leg").Reflectance = 1
Lyokon:findFirstChild("Left Leg").Transparency = 1
Lyokon:findFirstChild("Right Leg").Reflectance = 1
Lyokon:findFirstChild("Right Leg").Transparency = 1
wait(0.5)
--=========================================================
--Fail check 2
if (Lyokon.Humanoid.Health == 0 and Lyokon.Humanoid.MaxHealth > 0) then FailedToVirtualize() end
if (VirtualizationFailed == true) then return end
CreateMessage("Virtualization.", 0.5)
wait(0.5)
print("Teleport to Lyoko")
RandomTeleport()
Lyokon:findFirstChild("Torso").Anchored = true --Hold in midair during second half of virtualization.
--Sparkles time!
Sparkly = Instance.new("Sparkles")
Sparkly:clone().Parent = Lyokon:findFirstChild("Head")
Sparkly:clone().Parent = Lyokon:findFirstChild("Torso")
Sparkly:clone().Parent = Lyokon:findFirstChild("Left Arm")
Sparkly:clone().Parent = Lyokon:findFirstChild("Right Arm")
Sparkly:clone().Parent = Lyokon:findFirstChild("Left Leg")
Sparkly:clone().Parent = Lyokon:findFirstChild("Right Leg")
--Reappear over sector, then fall into it
Lyokon:findFirstChild("Head").Transparency = 0
wait(.25)
Lyokon:findFirstChild("Head").Reflectance = 0
Lyokon:findFirstChild("Torso").Transparency = 0
wait(.25)
Lyokon:findFirstChild("Torso").Reflectance = 0
Lyokon:findFirstChild("Left Arm").Transparency = 0
Lyokon:findFirstChild("Right Arm").Transparency = 0
wait(.25)
Lyokon:findFirstChild("Left Arm").Reflectance = 0
Lyokon:findFirstChild("Right Arm").Reflectance = 0
Lyokon:findFirstChild("Left Leg").Transparency = 0
Lyokon:findFirstChild("Right Leg").Transparency = 0
wait(.25)
Lyokon:findFirstChild("Left Leg").Reflectance = 0
Lyokon:findFirstChild("Right Leg").Reflectance = 0
wait(.25)
Lyokon:findFirstChild("Head").Sparkles:Remove()
Lyokon:findFirstChild("Torso").Sparkles:Remove()
Lyokon:findFirstChild("Left Arm").Sparkles:Remove()
Lyokon:findFirstChild("Right Arm").Sparkles:Remove()
Lyokon:findFirstChild("Left Leg").Sparkles:Remove()
Lyokon:findFirstChild("Right Leg").Sparkles:Remove()
--Make sure there's no missing limbs during virtualization :D
Lyokon.Head.Transparency = 0
wait(0.1)
Lyokon.Torso.Transparency = 0
wait(0.1)
Lyokon:findFirstChild("Left Arm").Transparency = 0
wait(0.1)
Lyokon:findFirstChild("Right Arm").Transparency = 0
wait(0.1)
Lyokon:findFirstChild("Left Leg").Transparency = 0
wait(0.1)
Lyokon:findFirstChild("Right Leg").Transparency = 0
--Drop into Lyoko, and reset the Scanner
Lyokon:findFirstChild("Torso").Anchored = false
Lyokon:findFirstChild("Torso").Velocity = Vector3.new(0, 0, 0)
script.Parent.BrickColor = BrickColor.new("Bright red")
Scanner.ScannerDoor.CanCollide = false
Scanner.ScannerDoor.Transparency = 1
ScannerDebounce = true
end
VirtualizationFailed = false
end
ScannerDebounce = true
wait(1)
end
script.Parent.Touched:connect(GoToLyoko)
|