Hello developers,
I’m making a horror facility game but, look, this is not working the way i wanted it to:
local CollectionService = game:GetService("CollectionService")
local TS = game:GetService("TweenService")
local ComputersNeeded = 3
local ComputersCompleted = 2
for _, Computer in pairs(CollectionService:GetTagged("Computer")) do
local Prompt = Instance.new("ProximityPrompt")
-- localizar os computadores mais faceis (só quando o jogo estiver em teste)
--local Highlight = Instance.new("Highlight")
--Highlight.Parent = Computer
--script
Prompt.Enabled = true
Prompt.Parent = Computer.Screen.Attachment
Prompt.ActionText = "Hack"
Prompt.ObjectText = "Computer"
Prompt.HoldDuration = 2
Prompt.Triggered:Connect(function(Player)
local ComputerGui = Player.PlayerGui.ComputerGui
local DisplayX = ComputerGui.Display.Position.X
TS:Create(ComputerGui.Display, TweenInfo.new(
1,
Enum.EasingStyle.Back,
Enum.EasingDirection.Out
),
{Position = UDim2.new(DisplayX, 0, 0, 0)}
):Play()
ComputerGui.Display.Text = "Computers hacked: "..ComputersCompleted.."/"..ComputersNeeded
task.delay(1.05, function()
if ComputersCompleted < 3 then
ComputerGui.Display.Text = "Computers hacked: "..ComputersCompleted.."/"..ComputersNeeded
else
ComputerGui.Display.Text = "All computers hacked, find the exit"
end
end)
task.delay(4, function()
if ComputersCompleted < 3 then
TS:Create(ComputerGui.Display, TweenInfo.new(
1,
Enum.EasingStyle.Back,
Enum.EasingDirection.In
),
{Position = UDim2.new(0.283, 0, -0.1, 0)}
):Play()
end
end)
ComputersCompleted += 1
Prompt.Enabled = false
end)
end
repeat task.wait()
until ComputersCompleted >= ComputersNeeded
local Highlight = Instance.new("Highlight")
local Prompt = Instance.new("ProximityPrompt")
local Debounce = false
Highlight.Parent = workspace.ComputerExit.GarageDoorExit
Prompt.Parent = workspace.ComputerExit.GarageDoorExit
Prompt.ActionText = "Enter"
Prompt.ObjectText = "Garage Door"
Prompt.Triggered:Connect(function()
if Debounce == false then
Debounce = true
for _, ServerPlayer in ipairs(game.Players:GetPlayers()) do
local FadeScreen = ServerPlayer.PlayerGui.ComputerGui.FadeScreen
local ServerCharacter = ServerPlayer.Character or ServerPlayer.CharacterAdded:Wait()
FadeScreen.Visible = true
ServerCharacter.HumanoidRootPart.CFrame = workspace.Facility.FacilityEnterPart.CFrame
ServerPlayer.PlayerGui.ComputerGui.Display.Visible = false
game.ServerScriptService.LightOff.Enabled = false
game.Lighting.TimeOfDay = 12
game.ReplicatedStorage.LightOffSounds:Destroy()
game.SoundService.Ambience:Stop()
game.SoundService.AmbientReverb = Enum.ReverbType.Arena
Highlight:Destroy()
--workspace.ParkGarage:Destroy()
task.wait(5)
TS:Create(FadeScreen, TweenInfo.new(4), {BackgroundTransparency = 1}):Play()
end
end
end)
Highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
Highlight.FillColor = Color3.fromRGB(55, 255, 0)
It may look normal, but for some reason, it is not teleporting all the players, and it is bugging out like, BUGGING VERY MUCH. I can’t know why is this happening, but can you guys help me?
Thank you.
Edit: I think i may have saw the problem, the problem is that the player is teleporting succefully, but the screen gui is not being invisible anymore for the other player, only for the player that triggered the prompt.
–laheitorzito303030