Answered by
4 years ago Edited 4 years ago
You need to pass the player object instead of the player name inside of the table to that function
Also, when removing objects from a table using table.remove
, the table is shifted
03 | if debounce = = false then |
05 | script.Parent.Touched:Connect( function (hit) |
06 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
07 | table.insert(players, 1 , hit.Parent) |
08 | local humanoid = hit.Parent:FindFirstChild( "Humanoid" ) |
10 | humanoid.WalkSpeed = 0 |
11 | humanoid.JumpPower = 0 |
12 | humanoid.Parent.HumanoidRootPart.Position = game.Workspace.ParkBench.Seat 1. Position |
13 | game.Workspace.ParkBench.Seat 1. Value.Value = true |
14 | if game.Workspace.ParkBench.Seat 1. Value.Value = = true then |
15 | humanoid.Parent.HumanoidRootPart.Position = game.Workspace.ParkBench.seat 2. Position |
16 | game.Workspace.ParkBench.seat 2. Value.Value = true |
18 | if game.Workspace.ParkBench.seat 2. Value.Value = = true then |
20 | humanoid.Parent.HumanoidRootPart.Position = game.Workspace.ParkBench.Seat 3. Position |
21 | game.Workspace.ParkBench.Seat 3. Value.Value = true |
23 | if game.workspace.ParkBench.Seat 3. Value.Value = = true then |
24 | script.Parent.Parent.BusStopShelter.Players.Value = 3 |
26 | humanoid.WalkSpeed = 0 |
27 | humanoid.JumpPower = 0 |
30 | if script.Parent.Parent.BusStopShelter.Players.Value = = 3 then |
31 | local animator = require(game.Workspace.Leave.Animator) |
32 | animator.NewTween:Play() |
33 | local teleportservice = game:GetService( "TeleportService" ) |
34 | teleportservice:TeleportPartyAsync(removedid, players) |
39 | table.remove(players, 1 ) |
40 | table.remove(players, 1 ) |
41 | table.remove(players, 1 ) |