So I am trying to connect some events in order that the server should change an object value, containg a eleport’s destination. The value is changing, but the destination, not. I want something that could refresh the script, or change the teleport’s destination. Anyone any help?
What does your code look like?
Code that changes location
local programs = workspace.SuperComputer.ComputerPrograms
RemotesFolder.ChangeScannerDestinationCore.OnServerEvent:Connect(function()
workspace.Scanner.Destination.Value = workspace.ScannerExitPointCore
end)
RemotesFolder.ChangeScannerDestinationWorkTower.OnServerEvent:Connect(function()
workspace.Scanner.Destination.Value = workspace.ScannerExitPointTower
end)
Teleporter code
local SCANNER = script.Parent
local SCANNER_DESTINATION = SCANNER.Destination
local SCANNER_EXIT_POINT = SCANNER_DESTINATION.Value
local SCAN_RING = SCANNER_EXIT_POINT.Ring
local VIRT_ANIM = SCANNER.Uranium:LoadAnimation(script:WaitForChild("CloseAndScan"))
local DEVIRT_ANIM = SCANNER.Uranium:LoadAnimation(script:WaitForChild("ScanAndOpen"))
local TRIGGER = SCANNER:WaitForChild("Trigger")
local EFFECT_PART = SCANNER:WaitForChild("EffectPart")
local SCANNER_DOOR_SOUND = EFFECT_PART:WaitForChild("Doors")
local SCAN_SOUND = EFFECT_PART:WaitForChild("Scanning")
local SCAN_PARTICLE = EFFECT_PART:WaitForChild("ParticleEmitter")
local SMOKE = EFFECT_PART.SmokeAttachment.Smoke
local EXIT_POINT = SCANNER_EXIT_POINT.ExitPoint
local VIRT_SOUND = EFFECT_PART:WaitForChild("Virt")
local IN_LYOKO_SCAN_SOUND = SCAN_RING:WaitForChild("VirtSound")
local IN_USE_VALUE = SCANNER.InUse.Value
local RING_SCAN_ANIM = SCANNER_EXIT_POINT.Scanner:LoadAnimation(script:WaitForChild("RingAnim"))
local RING_SCAN_PARTICLE = SCAN_RING.ParticleEmitter
local RING_SCAN_LIGHT = SCAN_RING.PointLight
local RING_SCAN_TRASPARENCY = 0.65
local EVENT = game.ReplicatedStorage:WaitForChild("Virtualize")
TRIGGER.Touched:Connect(function(PART_THAT_TOUCHED)
local USER = game.Players:GetPlayerFromCharacter(PART_THAT_TOUCHED.Parent)
local CHARACTER = USER.Character
local HUMANOID = CHARACTER.Humanoid
local R15_SCAN = HUMANOID:LoadAnimation(script:WaitForChild("VirtR15"))
local R6_SCAN = HUMANOID:LoadAnimation(script:WaitForChild("VirtR6"))
if IN_USE_VALUE == false then
if HUMANOID.RigType == Enum.HumanoidRigType.R15 then
CHARACTER.HumanoidRootPart.Anchored = true
IN_USE_VALUE = true
VIRT_ANIM:Play()
SCANNER_DOOR_SOUND:Play()
wait(1)
SCAN_PARTICLE.Enabled = true
SCAN_SOUND:Play()
wait(3.2)
SCAN_PARTICLE.Enabled = false
EVENT:FireClient(USER)
VIRT_SOUND:Play()
wait(1)
RING_SCAN_PARTICLE.Enabled = true
CHARACTER:MoveTo(EXIT_POINT.Position)
R15_SCAN:Play()
SCAN_RING.Transparency = RING_SCAN_TRASPARENCY
RING_SCAN_LIGHT.Enabled = true
RING_SCAN_PARTICLE.Enabled = true
RING_SCAN_ANIM:Play()
IN_LYOKO_SCAN_SOUND:Play()
wait()
RING_SCAN_PARTICLE.Enabled = false
IN_LYOKO_SCAN_SOUND:Stop()
R15_SCAN:Stop()
SCAN_RING.Transparency = 1
RING_SCAN_LIGHT.Enabled = false
RING_SCAN_PARTICLE.Enabled = false
CHARACTER.HumanoidRootPart.Anchored = false
wait(2)
IN_USE_VALUE = false
else
CHARACTER.HumanoidRootPart.Anchored = true
IN_USE_VALUE = true
VIRT_ANIM:Play()
SCANNER_DOOR_SOUND:Play()
wait(1)
SCAN_PARTICLE.Enabled = true
SCAN_SOUND:Play()
wait(3.2)
SCAN_PARTICLE.Enabled = false
EVENT:FireClient(USER)
VIRT_SOUND:Play()
wait(1)
RING_SCAN_PARTICLE.Enabled = true
CHARACTER:MoveTo(EXIT_POINT.Position)
R6_SCAN:Play()
SCAN_RING.Transparency = RING_SCAN_TRASPARENCY
RING_SCAN_LIGHT.Enabled = true
RING_SCAN_PARTICLE.Enabled = true
RING_SCAN_ANIM:Play()
IN_LYOKO_SCAN_SOUND:Play()
wait(3)
RING_SCAN_PARTICLE.Enabled = false
IN_LYOKO_SCAN_SOUND:Stop()
R6_SCAN:Stop()
SCAN_RING.Transparency = 1
RING_SCAN_LIGHT.Enabled = false
RING_SCAN_PARTICLE.Enabled = false
CHARACTER.HumanoidRootPart.Anchored = false
wait(2)
IN_USE_VALUE = false
end
end
end)