Teleport Players With Qualification Problem

Hello. So, I made this part of script when if the player has an object value inside of them named ‘GameText’, they would be teleport-ed to somewhere else. Here is the part of code I was talking about.

	local players = game.Players:GetPlayers()
	for i = 1,#players do
		if players[i]:FindFirstChild("GameText") then
		players[i].Character.Torso.CFrame = CFrame.new(randommapclone.Spawn.Tele.Position)
		end
	end

It didn’t work and no errors were printed. If I removed:

if players[i]:FindFirstChild("GameText") then

end

and tested the game, it works perfectly fine without the qualification. Either it’s just me or the script. Please help down below and if I missed anything message me please.

1 Like

where is the GameText normally placed? can you show me that part of the code?

Well, It’s in a local script. Let me show you.

	local Value = Instance.new("ObjectValue")
	Value.Parent = player
	Value.Name = "GameText"

check if it’s there on the server in a test play, in studio, in the explorer tab.

I did multiple times. It showed the Object Value, but still.

so the script that you have trouble with is running normally until the for loop? when does it stop printing, try print-debugging it and see how it goes, where it stops and where the breakpoint is.

2 Likes

It automatically stopped at the if statement. I’m still confused, though.

I believe that it doesn’t find the GameText, it either doesn’t load on time or it doesn’t appear on the server script (if that is a server script).

The code that has the for loop is a server script. Is there any thing wrong with that?

Server script doesn’t see the changes done to Player locally, there could be another issue but I think it’s that.

Is there a solution to this? problem? I couldn’t think of anything yet.

maybe try it via Remotes, connect that local script with the server script and send the GameText in
FireServer().

So any server script can access that specific value if it is edited in the server script? (Sent a RemoteFunction).

1 Like

Server basically does not care what the client did or does, just like it’s explained with FilteringEnabled, whatever the client did, it will appear for the client and server will mind it’s own business and ignore what client did (in most cases).

1 Like