Proximity Prompts not enabling correctly on the client

GENERAL ISSUE: client still cant see the proximityprompt, even when the client sets the proximityprompt’s enabled property to true.

hi, i’m working on a project that utilizes proximity prompts for an “execution” ability for an “assassin” role. essentially, the assassin goes up to any player and the prompt will pop up to execute said player. currently, the prompt does nothing but just print to the output.

the way it works is that in the server, in a module script, it grabs an executionprompt from the replicated storage and it clones it to each player’s (who isnt an assassin) uppertorso. by default, on the server, the executionprompt’s “Enabled” property, is set to false.

function roleModule.assignRoles()
	--this is where all the players are chosen to be their roles
	local bystandersTable = players:GetPlayers()
	
	local randomAssassinIndex = math.random(1, #bystandersTable)
	local assassinPlayer = bystandersTable[randomAssassinIndex]
	table.remove(bystandersTable, randomAssassinIndex)
	
	local randomUndercoverIndex = math.random(1, #bystandersTable)
	local undercoverPlayer = bystandersTable[randomUndercoverIndex]
	table.remove(bystandersTable, randomUndercoverIndex)
	
	-- for every bystander
	for i, plr in bystandersTable do
		local char = plr.Character
-- this is where the prompt gets cloned to the player
		local upperTorso = char:WaitForChild("UpperTorso")
		local promptClone = executionPrompt:Clone()
		promptClone.Parent = upperTorso
		
		roleModule.assignRoleTo(plr, "Bystander")
	end
	
	roleModule.assignRoleTo(undercoverPlayer, "Undercover")
-- this is also where the prompt gets cloned to undercover
	local char = undercoverPlayer.Character
	local upperTorso = char:WaitForChild("UpperTorso")
	local promptClone = executionPrompt:Clone()
	promptClone.Parent = upperTorso
	
	roleModule.assignRoleTo(assassinPlayer, "Assassin")
	
	
end

on the client, when the player’s role is changed to assassin, it’ll set all of the executionprompts’ “Enabled” property to true. this should make it so that the assassin is the only person in game who can view and use the execution prompts. now, this works when the “RequiresLineOfSight” property is set to false. however, i dont want the assassins to be able to execute through walls. so when i set the “RLOS” property to true, the proximity prompt doesn’t show up anymore, no matter if you have a line of sight or not.

local reps = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")

local roleMod = require(reps.Player:WaitForChild("Role"))


local player = players.LocalPlayer

player:GetAttributeChangedSignal("Role"):Connect(function()
	wait(2)
-- lil wait just to let things load
	if player:GetAttribute("Role") == "Assassin" then
		for i, plr in players:GetPlayers() do --for every player
			if plr.Name ~= player.Name then -- if the player ISNT the assassin
				local char = plr.Character
				local upperTorso = char.UpperTorso
				if upperTorso:FindFirstChild("ExecutionPrompt") then -- if the player's uppertorso has an execution prompt
					print("found prox prompt on" ..plr.Name) -- some debugging
					local proxPrompt = upperTorso.ExecutionPrompt 

					proxPrompt.Enabled = true -- set their execution prompt's enabled property to true
				end
			end
		end
	end
end)

checking the explorer on the assassin’s client and looking at all the other player’s executionprompts in their uppertorso shows that the “Enabled” property is properly being set to true.

i’d like some help on this issue. i just recently decided to get back into scripting and this issue has been bugging me for a few days.

Uhm… did you make sure to set RequiresLineOfSight to true?

1 Like

yes. rlos is always true by default. however, the prompt only shows up when rlos is false.

Try adding a part and put the proximity prompt in the part. This way you can rotate the part and see which way it’s correct. Make sure to weld the part to the torso.