Proximity prompt doesnt clone again

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)
1 Like

The proximity prompts are cloned and attached to the players’ torsos right?

Is there another script for triggering the prompt?

1 Like

yes they are cloned to the player’s torso
there is another script for triggering the prompt and it works

1 Like

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

1 Like

script inside the scareprompt

script.Parent.Triggered:Connect(function(playerwhotriggered)
	playerwhotriggered.KillStreak.Value += 1
	playerwhotriggered.leaderstats.Souls.Value += playerwhotriggered.KillStreak.Value
	local playerwhohadprox = script.Parent.Parent.Parent
	local actualplayer = game.Players:GetPlayerFromCharacter(playerwhohadprox)
	actualplayer.KillStreak.Value = 0
	game.ReplicatedStorage.Jumpscare:FireClient(actualplayer, playerwhohadprox)
	actualplayer.PlayerGui.Tutorial.Enabled = false
	actualplayer.PlayerGui.stats.Enabled = false
	actualplayer.PlayerGui.Shop.Enabled = false
	wait(2.25)
	actualplayer.PlayerGui.Tutorial.Enabled = true
	actualplayer.PlayerGui.stats.Enabled = true
	actualplayer.PlayerGui.Shop.Enabled = true
end)

onclientevent script in starterpack

game.ReplicatedStorage.Jumpscare.OnClientEvent:Connect(function(actualplayer, playerwhohadprox)
	local cfr = workspace.Camera.CFrame
	local area = workspace.JumpscareArea
	local o = area.campos1
	
	workspace.Camera.CameraType = Enum.CameraType.Scriptable
	workspace.Camera.CFrame = o.CFrame
	workspace.Player.MLGScare:Play()
	workspace.Player.AAAAAA:Play()
	workspace.Player.aaaaa:Play()
	

	wait(2.25)
	workspace.Camera.CameraType = Enum.CameraType.Custom
	workspace.Player.MLGScare:Stop()
	workspace.Player.AAAAAA:Stop()
	workspace.Player.aaaaa:Stop()
end)

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.

1 Like

it worked but i had to remove the (function from the functions
and i had to change prompt to clone

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.