I have been working on these minigames and everything is going well, but there is one small problem, the lobby has chairs and since when you are sitting, you wont get teleported but will still count as in game. I tried to make the script unsit the players quickly before they teleport, but it doesn’t work. Got any ideas? This script is in Severscriptservice btw.
Enable the Jump property and it should jump them out of their seat then it will disable itself again.
Humanoid.Jump = true
Try humanoid.Seated = false
Change workspace.playername
to workspace[playername.Name]
Try this.
for _,Player in pairs(game.Players:GetPlayers()) do
if Player.Character ~= nil then
local spawnLocation = math.random(1, #workspace.Teleports.Teleports:GetChildren())
Player.Character.Humanoid.Jump = true
Player.Character:MoveTo(workspace.Teleports.Teleports:GetChildren()[spawnLocation].Position)
Player.Character.Parent = workspace.Ingame
end
end
Explained:
The first line is looping through all the players currently in the server.
The second line checks if the Players character isn’t nil
The third line grabs a random number between 1 and the total amount of spawners in your game
The Fourth line makes the Character Jump so if they’re seated it will take them out of the seat.
The Fifth line Moves the player to the random spawn
The sixth line parents the Player to the workspace folder/model named Ingame
Here, I updated your code
local players = game:GetService("Players")
local spawns = game:GetService("Workspace").Spawns
for _, player in ipairs(players:GetPlayers()) do
if player.Character ~= nil then
local spawnLocation = spawns[math.random(1, #spawns:GetChildren())]
local character = player.Character
character:FindFirstChildOfClass("Humanoid").Seated = false
character:MoveTo(spawnLocation.Position)
character.Parent = game:GetService("Workspace").InGame
end
end
Ahhhhhh, you beat me to it LOL
That wouldn’t work though, not only because the jump would cause them to not teleport in correctly, but because it completely kinda ruins the Ingame thing
Why wouldn’t it work? It makes the player jump like they would to manually “unsit”.
It wouldn’t work as in then it makes the Ingame folder not work and neither would the rest of the script. the script relies on how I have the ingame folder already set up.
Have you tried my code I gave?
That would also make the script not work as well.
uh, no it works just fine for me…
Did you even try my code or did you just look at it and say no. I’m going off the limited script snippets you have provided in the OP. I am not a mind reader, I cannot see the hidden parts of your script. Furthermore you should be providing every aspect of the script so we know if something will break it.
That is because you don’t have a bunch of other parts of the script that relies on how I already have the ingame set up
but I dont need the “other parts” you listed the code you needed help with which me and @IEnforce_Lawz has helped with.