Hello! I tried to make a player info GUI. I want it so that when you click a player, a GUI appears and shows information about him. (For now it’s just the username)
local Events = game.ReplicatedStorage:WaitForChild("Events")
local ClickedPlayerInfo = Events.ClickedPlayerInfoEvent
script.Parent.MouseClick:Connect(function(playerwhoclicked,viewplayerinfo)
ClickedPlayerInfo:FireClient(playerwhoclicked, game.Players:GetPlayerFromCharacter(script.Parent.Parent.Parent))
end)
This script is inside a ClickDetector which is inside a part that’s supposed to be the hitbox. This hitbox is inside every players character.
local Events = game.ReplicatedStorage:WaitForChild("Events")
local PlayerInfoEvent = Events.ClickedPlayerInfoEvent
PlayerInfoEvent.OnClientEvent:Connect(function(playerthatclicked,viewplayerinfo)
local frame = game.Players.LocalPlayer.PlayerGui.PlayerInfoGui.PlayerInfoFrame
frame.Visible = true
print(viewplayerinfo)
end)
This script is inside the StarterPlayerScripts. It’s supposed to print the name of the player whose hitbox has been clicked. But instead it just prints “nil”
Thanks for reading!