Issue with making another players gui show from a local script

i’m making this game where you rate other peoples avatars (rate my avatar but better) and to open the rating ui, you use a proximity prompt on another player. the proximity prompt works, but i’m trying to make it so a gui shows for the target player (the player whose avatar is being rated) that says you are being rated.

local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local localPlayer = Players.LocalPlayer

function t(...)
	TweenService:Create(...):Play()
end

local function waitForHRP(character)
	for _ = 1, 10 do
		local hrp = character:FindFirstChild("HumanoidRootPart")
		if hrp then return hrp end
		task.wait(0.2)
	end
	return nil
end

local function createPrompt(targetCharacter)
	local hrp = waitForHRP(targetCharacter)
	if not hrp then return end

	local existing = hrp:FindFirstChildOfClass("ProximityPrompt")
	if existing then return end

	local targetplayer = Players:GetPlayerFromCharacter(targetCharacter)
	if not targetplayer then return end

	local prompt = Instance.new("ProximityPrompt")
	prompt.Name = targetplayer.Name
	prompt.ActionText = "Rate avatar"
	prompt.ObjectText = targetCharacter.Name
	prompt.RequiresLineOfSight = false
	prompt.MaxActivationDistance = 3
	prompt.HoldDuration = 0
	prompt.Parent = hrp

	prompt.Triggered:Connect(function(player)
		local char = player.Character
		local hrp = char and char:FindFirstChild("HumanoidRootPart")
		if hrp then
			hrp.Anchored = true
			t(game.Lighting.Blur, TweenInfo.new(0.6), {Size = 25})
			targetplayer.PlayerGui.testnotif.Enabled = true
			targetplayer:WaitForChild("plrinfo"):WaitForChild("beingRated").Value = true
			player.PlayerGui:WaitForChild("Rate"):WaitForChild("Values"):WaitForChild("TargetUser").Value = targetplayer.Name
			player.PlayerGui:WaitForChild("Rate"):WaitForChild("Values"):WaitForChild("TargetID").Value = targetplayer.UserId
		end
	end)
end

local function handlePlayer(player)
	if player == localPlayer then return end

	local function onCharacterAdded(character)
		createPrompt(character)
	end

	if player.Character then
		createPrompt(player.Character)
	end

	player.CharacterAdded:Connect(onCharacterAdded)
end

for _, player in ipairs(Players:GetPlayers()) do
	handlePlayer(player)
end

Players.PlayerAdded:Connect(handlePlayer)

any help appreciated!

You’d need to use remote events / functions since local events aren’t replicated to other players

Filtering Enabled: what is it? :skull: ahhh post
You need RemoteEvent | Documentation - Roblox Creator Hub for server/client or client/server communication

1 Like

dont spread misinformation please.

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