Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to stop players from getting stuck?

Asked by 6 years ago
Edited 6 years ago

Hi,I am trying to make a Runner game,But when I teleport the players,the get stuck in the spawn loacation in the map as i am a amateur in scripting i know how to make teleport etc.But how do i prevent them from getting stuck heres a script i made

local replicatedstorage = game:GetService("ReplicatedStorage")
local status = replicatedstorage:WaitForChild("StatusValue")

while true do
-- Intermission
for i = 30,1,-1 do
status.Value = "Intermission: "..i 
wait(1)
end
function teleAll(x, y, z)
    local pos = Vector3.new(-42.3, 210.501, -1221.65)
    for _, plr in pairs(Game:GetService("Players"):GetPlayers()) do
        if plr.Character then
            plr.Character:MoveTo(pos)
        end
    end
end

teleAll(-42.3, 210.501, -1221.65)
status.Value = "Game in progress"

local replicatedstorage = game:GetService("ReplicatedStorage")
local status =replicatedstorage:WaitForChild ("Knife")
local map = game.ServerStorage.Greenhils

map:Clone().Parent = game.Workspace
wait(180)
game.Workspace.Greenhils:Destroy()
status.Value = "Game Over!"
end

1 answer

Log in to vote
0
Answered by 6 years ago

Increase the 'y' position of your Vector3 to spawn the players slightly above the SpawnLocation.

0
good job you can do simple addition hiimgoodpack 2009 — 6y
Ad

Answer this question