I don't know what to do, I'm a pretty basic scripter. It's just that the RemoteEvent won't fire. Used for a group teleporter system.
serverscriptservice script
local waitingPlayers = {}
local touchable = true
local part = workspace.TelporterBuilding.TP
local part2 = workspace.TelporterBuilding.Outside
game.Workspace.TelporterBuilding.PortalPart.Touched:Connect(function(tp)
if tp.Parent and tp.Parent:FindFirstChildOfClass("Humanoid") and touchable == true then
local plr = game.Players:GetPlayerFromCharacter(tp.Parent)
plr.Character.HumanoidRootPart.CFrame = part.CFrame
table.insert(waitingPlayers, plr)
game.ReplicatedStorage:WaitForChild("ActivateGUI"):FireClient(plr)
end
end)
local TS = game:GetService("TeleportService")
local Timer = game.Workspace.TelporterBuilding.PortalPart.SurfaceGui.Countdown
local Seconds = Timer.Time
repeat
repeat
Timer.Text = "NORMAL MODE"
wait(5)
Code = TS:ReserveServer(5257516432)
until #waitingPlayers >=1
if #waitingPlayers >= 1 and touchable == true then
repeat
wait(1)
Seconds.Value = Seconds.Value - 1
Timer.Text = Seconds.Value
until Seconds.Value == 0
Timer.Text = "Teleporting players."
for i, player in pairs (waitingPlayers) do
print("Player teleporting!")
TS:TeleportToPrivateServer(5257516432, Code, waitingPlayers)
end
touchable = false
wait(2)
waitingPlayers = {}
wait(1)
touchable = true
Timer.Text = "NORMAL MODE"
Seconds.Value = 30
end
until false
game.ReplicatedStorage.RemovePlayer.OnServerEvent:Connect(function(plr)
plr.Character.HumanoidRootPart.CFrame = part2.CFrame
table.remove(waitingPlayers,plr)
end)
localscript inside textbutton
game.ReplicatedStorage.ActivateGUI.OnClientEvent:Connect(function()
script.Parent.Visible = true
end)
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.RemovePlayer:FireServer()
script.Parent.Visible = false
end)
