#Teleporting after changing character

1 messages · Page 1 of 1 (latest)

frail mica
#

How would i make it so the player doesn't move when they're being changed to the survivor they selected? I know this would cause a bug as if the character loading fires slower than the round tping it'd just bring them to where the model is.
-# ill copy the servers round system over in a moment.

#
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local INTER_TIME = 5
local ROUND_TIME = 10
local MIN_PLAYERS = 1


local function TpPlayers(cframe)
    local players = Players:GetPlayers()
    for i, player in players do
        if not player.Character then continue end
        player.Character:PivotTo(cframe)
    end
end

local function Countdown(duration)
    for i=duration, 1, -1 do
        workspace:SetAttribute("Clock", i)
        task.wait(1)
    end
end

local function Intermission()
    TpPlayers(workspace.SpawnLocation.CFrame * CFrame.new(0, 2, 0))
    print("Intermission")
    workspace:SetAttribute("Status", "Intermission")
    Countdown(INTER_TIME)
end

local function TheGame(map)
    TpPlayers(map.Spawn.CFrame)
    print("Game started")
    workspace:SetAttribute("Status", "Game")
    Countdown(ROUND_TIME)
    map:Destroy()
end


while true do
    if #Players:GetPlayers() >= MIN_PLAYERS then
        Intermission()
        
        workspace:SetAttribute("Status", "Loading map")
        local maps = ReplicatedStorage.Maps:GetChildren()
        local ranmap = maps[math.random(#maps)]
        local newmap = ranmap:Clone()
        newmap.Parent = workspace
        task.wait(1)
        
        TheGame(newmap)
    else
        workspace:SetAttribute("Status", "Waiting for players")
        print("Not enough players")
        task.wait(1)
    end
end```
#

Something i tried doing was putting the character selector script in the round system [They're in the same place; seemingly shouldn't change a thing] But it just ended up completely skipping over changing the character. Is there a reason? could i of just put it in a bad area?

rustic thistle
#

Why dont instend of force changing the caracter you just clear it and apply descriptions?

#

I think this is better since the player will not be also force to stop moving and it can just go freely, everything can go freely without the need of re starting the chracter

#

This

frail mica
#

sorry that was a bit of writing

#

I want the character to completely restart

rustic thistle
#

Oh you mean

warped salmonBOT
#

studio** You are now Level 4! **studio

rustic thistle
#

Oh so like, that little frame where we can see the character

#

Prevent this?

frail mica
#

yea

rustic thistle
#

Oh just save the OriginalCharacter Pivot

#

And apply it to the new one

#

This way it will make it look like you didnt move and the character just changed it self

#

Hold on

frail mica
#

Ohh alright

#

that should be simple enough

rustic thistle
#

Oh nvm looks like you already know how to use Pivots

#

Yea

#

Make sure to save the Pivot Before using the LoadCharacter()

frail mica
#

Thanks