local player = game:GetService("Players").LocalPlayer
local hum = player.Character:WaitForChild("Humanoid")
local TS = game:GetService("TweenService")
local TeleportColorCorrection = Instance.new("ColorCorrectionEffect")
TeleportColorCorrection.Parent = game.Lighting
function TeleportFlash()
TeleportColorCorrection.Brightness = 1
TS:Create(TeleportColorCorrection, TweenInfo.new(1), {Brightness = 0}):Play()
TeleportColorCorrection:Destroy()
end
local SecretPartDebounce = false
local SecretTeleporterDebounce = false
Map.Geometry.SecretPart.Touched:Connect(function()
if SecretPartDebounce == false then
SecretPartDebounce = true
game.Workspace.Sounds.SecretPart:Play()
Map.Geometry.SecretPart.Transparency = 0.7
end
end)
game.Workspace.SecretTeleporter.Touched:Connect(function()
if SecretTeleporterDebounce == false then
SecretTeleporterDebounce = true
game.Workspace.Sounds.SecretTeleporter:Play()
spawn(TeleportFlash())
local Character = player.Character or player.CharacterAdded:Wait()
Character:PivotTo(CFrame.new(game.Workspace.SecretTeleportTo.Position))
end
end)
The script plays the sound but doesn’t do the flash or the teleportation. How do I fix this?
local player = game:GetService("Players").LocalPlayer
local hum = player.Character:WaitForChild("Humanoid")
local TS = game:GetService("TweenService")
local Character = player.Character or player.CharacterAdded:Wait()
local TeleportColorCorrection = Instance.new("ColorCorrectionEffect")
TeleportColorCorrection.Parent = game.Lighting
function TeleportFlash()
TeleportColorCorrection.Brightness = 1
TS:Create(TeleportColorCorrection, TweenInfo.new(1), {Brightness = 0}):Play()
TeleportColorCorrection:Destroy()
end
local SecretPartDebounce = false
local SecretTeleporterDebounce = false
Map.Geometry.SecretPart.Touched:Connect(function()
if SecretPartDebounce == false then
SecretPartDebounce = true
game.Workspace.Sounds.SecretPart:Play()
Map.Geometry.SecretPart.Transparency = 0.7
end
end)
game.Workspace.SecretTeleporter.Touched:Connect(function()
if SecretTeleporterDebounce == false then
SecretTeleporterDebounce = true
game.Workspace.Sounds.SecretTeleporter:Play()
spawn(TeleportFlash)
Character:SetPrimaryPartCFrame(CFrame.new(game.Workspace.SecretTeleportTo.Position))
end
end)
Minor coding mistake. Here’s what I fixed for you, try it and tell me later if it works.
local player = game:GetService("Players").LocalPlayer
local hum = player.Character:WaitForChild("Humanoid")
local TS = game:GetService("TweenService")
local TeleportColorCorrection = Instance.new("ColorCorrectionEffect")
TeleportColorCorrection.Parent = game.Lighting
function TeleportFlash()
TeleportColorCorrection.Brightness = 1
TS:Create(TeleportColorCorrection, TweenInfo.new(1), {Brightness = 0}):Play()
wait(1)
TeleportColorCorrection:Destroy()
end
local SecretPartDebounce = false
local SecretTeleporterDebounce = false
Map.Geometry.SecretPart.Touched:Connect(function()
if SecretPartDebounce == false then
SecretPartDebounce = true
game.Workspace.Sounds.SecretPart:Play()
Map.Geometry.SecretPart.Transparency = 0.7
end
end)
game.Workspace.SecretTeleporter.Touched:Connect(function()
if SecretTeleporterDebounce == false then
SecretTeleporterDebounce = true
game.Workspace.Sounds.SecretTeleporter:Play()
coroutine.resume(coroutine.create(function()
TeleportFlash()
end))
local Character = player.Character or player.CharacterAdded:Wait()
Character:PivotTo(CFrame.new(game.Workspace.SecretTeleportTo.CFrame))
end
end)