This is my game: Skill Fighter Beta, which can be accessed at SKILL FIGHTER [BETA] - Roblox.
Within the game, there is an occasional issue where, if a player joins a match, leaves, and then joins again, they experience a situation where they are unable to see the other player, even though the other player can still see them.
I suspect that this problem is related to the teleportation mechanic in my game. Upon clicking the ‘play’ button, players are teleported to a map located far away from the initial spawn location.
I would greatly appreciate any suggestions or assistance in resolving this issue.
This is the teleportation script:
--LOCAL SCRIPT--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local StartGame_remote = Remotes:WaitForChild("StartGame")
local Screen = script.Parent
local PlayButton = Screen:WaitForChild("PlayButton")
PlayButton.MouseButton1Click:Connect(function()
StartGame_remote:FireServer()
end)
--SERVER SCRIPT--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local StartGame_remote = Remotes:WaitForChild("StartGame")
local GameZone = workspace:WaitForChild("GameZone")
local GameZoneBaseplate = GameZone:WaitForChild("Baseplate")
--GameZoneBaseplate Position == Vector3.new(0,-10,1000)
StartGame_remote.OnServerEvent:Connect(function(player)
local char = player.Character
if char then
local HumanoidRootPart = char:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart then
HumanoidRootPart.Position = GameZoneBaseplate.Position + Vector3.new(math.random(-65,65), 7, math.random(-65,65))
end
end
end)
*There is no problem with the script itself.