Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do i teleport someone that hasn't been teleported yet by script?

to explain this better, how do i make the script teleport someone that hasn't been teleported yet but doesn't teleport the person that it already teleported?

local plrs = workspace:GetChildren()
local Part = workspace:WaitForChild("BStage")

wait(1) 

Players = game.Players:GetPlayers()
Plr = Players[math.random(#Players)]
Plr.Character:SetPrimaryPartCFrame(Part.CFrame)

6 comments

0

Insert a BoolValue into that player called "Teleported" and set to true once they did get teleported.

0

im guessing i put the value in replicated storage?

0

i put the bool in replicated storage, now how do i script it?

0

Just put the BoolValue in the player and set it to false, then make something like if (player.BoolValue = false) then.... teleport, once the player has teleported set the value to true.

0

yes if player.BoolValue.Value then ... else -- teleport player end

0

where do i find the player? :/ ik this is frustrating but, i'm confused ...

1 answer

Theres a lot of way to implement this, and its really depend on how you want it to work exactly

e.g Player dies > Teleports him back to the round > don't teleport people inside the round

or Player joined the game > Teleports him somewhere or maybe you just want to teleport him once etc etc

one way you can do this is to add a bool somewhere when the player joined

game.Players.PlayerAdded:connect(function(ply)
	boolVal = Instance.new("BoolValue")
	boolVal.Name = "Teleported"
	boolVal.Parent = ply

end)

and then change the value to "True" and teleports him when his character spawned

game.Players.PlayerAdded:connect(function(ply)
	boolVal = Instance.new("BoolValue")
	boolVal.Name = "Teleported"
	boolVal.Parent = ply
	
	ply.CharacterAdded:connect(function(char)
		if ply.boolVal.Value == false then
			char.HumanoidRootPart:CFrame = YourTeleportLocationHere
			ply.boolVal.Value = true
		end
	end)
end)

This should teleport someone when they spawned, once

if this is not what you want. then you should give specific details on how you want your script to work

2 comments

0

BTW use :Connect(), :connect() is deprecated

0

Welp, still works anyway

This discussion is preserved as it was. New answers, comments, and votes are closed.