Show GUI when a player is clicked

Hello,

I want a player to be able to click on another player in my game and see a GUI with certain information about the player like you can in Flex Your Account Age or Trade Hangout.

How would I go about implementing this?

image

1 Like

This is actually pretty easy. You can do this by having a template gui in ReplicatedStorage and have code add clickdetectors in every HumanoidRootPart (using the CharacterAdded event). Add a characterscript about the ClickDetector and make it clone the template, customize it to your likings (inside the script) and add it into the LocalPlayer’s PlayerGUI

2 Likes

Whenever a player joins in game send request to a roblox proxy (better create ur own for security reasons) to get the required information. You can create a proxy relatively easily with Roblox API wrappers like ro.py, noblox.js or bloxy.js.

1 Like

Don’t worry I’ve already got all that part figured out. I just needed the gui. I think the best solution is just a clickdetector.

And yes I am using a roblox proxy

1 Like

Ah I c, in that case create a click detector on the server side (like you said) parented to all player’s character and then whenever clickdetector.MouseClick fires, get the player who clicked and fire a RE to the player with the details of clicked player (followers, RAP, visits)

1 Like

So what I would do, is something like this:

--this is a localscript
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()

local function mouseClick()
	if mouse.Target.Parent:IsA("Accessory") then
		if mouse.Target.Parent.Parent:FindFirstChild("Humanoid") then
			local characterName = mouse.Target.Parent.Parent.Name
			print(characterName)

			--then you can make the gui appear with this information
		end
	else
		if mouse.Target.Parent:FindFirstChild("Humanoid") then
			local characterName = mouse.Target.Parent.Name
			print(characterName)
	
			--then you can make the gui appear with this information
		end
	end
end

mouse.Button1Down:Connect(mouseClick)

This can get the characters name, which can be used to open the right GUI.

1 Like

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