So i have an issue where i have 2 players in a server in my game, and theres a proximity prompt that spawns on each players torso. So when the first person joins the game and then the second, the first person who joined is able to activate the proximity prompt on the other player. Meanwhile the second person who joined cannot activate the proximity prompt on the first player
Cant find a solution to this
code
game.Players.PlayerAdded:Connect(function(player)
wait(1.5)
local clone = script.Parent.ScarePrompt:Clone()
local character = player.Character
clone.ObjectText = player.Name
if character:FindFirstChild("UpperTorso") then
clone.Parent = character:WaitForChild("UpperTorso")
else
clone.Parent = character:WaitForChild("Torso")
end
end)
Could we see that script? Depending on the script, you may have only had the proximity prompt only work for when the first player joins, then when the second player joins it’s not
It could be because it takes more than 1.5 seconds for a player’s character to load in. This would cause an error, but this solution is worth giving a shot:
local function OnCharacterAdded(function(character)
local prompt = script.Parent.ScarePrompt:Clone()
clone.ObjectText = player.Name
clone.Parent = character:FindFirstChild("UpperTorso") or character:FindFirstChild("Torso")
end)
local function OnPlayerAdded(function(player)
player.CharacterAdded:Connect(OnCharacterAdded)
if player.Character then
OnCharacterAdded(player.Character)
end
end)
game.Players.PlayerAdded:Connect(OnPlayerAdded)
Also make sure that the ProximityPrompt has the RequiresLineOfSight property set to false.