How do I make the character not fling after teleport to another position

Hello,
I have this problem where the character gets flung after the player walks while being teleported to a different position and I unanchor the humanoidrootpart.
Does anyone know how to fix this?
This is the script:

for i, player in pairs(game.Players:GetChildren()) do
			player.Character:FindFirstChild("Humanoid").WalkSpeed = 0
			player.Character.HumanoidRootPart.Anchored = true
		end

		for i = 5, 0, -1 do

			Inter.Value = "Game starting in: "..i
			task.wait(1)

		end
		for i, player in pairs(game.Players:GetChildren()) do
			player.Character:FindFirstChild("Humanoid").WalkSpeed = 16
			player.Character.HumanoidRootPart.Anchored = false
			game.ReplicatedStorage.GuiEvent:FireClient(player)
		end

any help is appreciated!

Wich script are u using to move player?

I am using a serverscript to move them

Try to set humanoid state to Physics instead changing humanoid walk speed

just set the Velocity = Vector3.New(0,0,0)
easy as that!

hope it helps!

can you implement it in the script because im not that good at scripting
or is it just player.Character.Velocity = Vector3.new(0,0,0)?

yes just that after teleporting!
cuz you cant fling without velocity!

It doesnt work it just says

Velocity is not a valid member of Humanoid "Workspace.OzeanSyler"

velocity of the humanoid? no, just set the velocity of the humanoid rootpart to 0 and it should work!

happy coding.

idk why but i still get flung, wait let me send a video

1 Like

uh filler idk what to put there

maybe just use :PivotTo() when the game starts

Apparently there are new forces being applied to the player, try using:

-- Services
local Players = game:GetService("Players")

-- The Function to Start Game
function GameStart()
	
		for _, Player in Players:GetPlayers() do -- Get the player
			local Character = Player.Character or Player.CharacterAdded:Wait()
			local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
			
		Humanoid:ChangeState(Enum.HumanoidStateType.Physics) -- Block Player to receive external forces
		Humanoid.WalkSpeed = 0
		
		coroutine.wrap(function() -- Do multiple tasks for Unlock all players at same time
		for i = 5, 0, -1 do
			
				task.wait(1)
				print(i,"seconds")

				if i == 0 then
					UnlockPlayer(Humanoid); -- Fire function to unlock player after 5 seconds
					warn("Game Started")
				end
			
			end
		end)()
		end
end

-- Function to Enable Player movement
function UnlockPlayer(Humanoid)
	
	Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp) -- Return Humanoid to default State
	Humanoid.WalkSpeed = 16
	
end
	
	Players.PlayerAdded:Connect(GameStart) --  Fire function to start game

nope still the same thing it just flings the character again

What script are you using to teleport the player? Simply using MoveTo() on the character should move the character to a given position, with no flinging.

For example, this code (in a LocalScript) should teleport the player to a given position with no flinging. Feel free to modify as needed for your game!

-- Get the player
local player = game.Players.LocalPlayer

-- Get the player's character
local character = player.Character

-- Check to see if they have a character
if character then -- If they do:
    -- Teleport their character
    character:MoveTo(Vector3.new(0,0,0)) -- Change the Vector3 values to whatever you like; this is your destination to teleport to
else -- But if they don't:
    -- Warn in the output that the character doesn't exist.
    warn("No character for player "..player.." exists!") -- This also tells us which player doesn't have the character.
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.