When spawning the player is going to the ceiling instead of spawning on top of the spawn, I verified that this is due to the Touched Event, if I remove the Touched and TochedEnd event the player spawns correctly.
Problem:

Script causing the error:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ChangePlayersInGame = ReplicatedStorage:WaitForChild("ChangePlayersInGame")
local PlayersInGame = {}
script.Parent.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
local players = game:GetService("Players"):GetPlayers()
if player then
local index = table.find(PlayersInGame, player)
if index then
table.remove(PlayersInGame, index)
end
ChangePlayersInGame:FireAllClients(PlayersInGame)
end
end)
script.Parent.TouchEnded:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
local index = table.find(PlayersInGame, player)
if not index then
table.insert(PlayersInGame, player)
end
ChangePlayersInGame:FireAllClients(PlayersInGame)
end
end)
The script is inserted in this part:

And the player is spawing on top of “Box” and not spawn.
Does anyone have an idea how to resolve this?