Trying get the Player using a Server Script

local Tool = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Gui = ReplicatedStorage.Gui.OverHead

Tool.Equipped:Connect(function(Player)
	local NewGui = Gui:Clone()
	NewGui.Parent = Tool.Card
	local ActualGui = Tool.Card:WaitForChild("OverHead")
	ActualGui.Nick.Text = Player.Name
	ActualGui.Team.Text = Player.Team.Name
	ActualGui.TeamColor = Player.TeamColor
end)

Tool.Unequipped:Connect(function()
	local DeleteTool = Tool.Card:FindFirstChild("OverHead"):Destroy()
end)

I am trying to get the: Name, Team Name and its Color.
Thus, completing my ID. I know I could do this with LocalScript but it would only show the user themselves and not others and I want everyone to be able to see it.

A note: I might not see the answers until tomorrow for personal reasons.

Some Images:

image
image

Afterall, its just gives a error and doesnt work properly.
image

Afterall, its just gives a error

What is the error?

22:08:20.497 Team is not a valid member of Mouse “Instance” - Servidor - OverHead:11

Tool.Equipped

does not return the player instance - instead it returns the player’s mouse.

Instead, try something like this

Tool.Equipped:Connect(function()
    local Player = Tool.Parent
    if Player:IsA("Model") then Player = game.Players:GetPlayerFromCharacter(Player) end
end
1 Like

It fixed the Script.
Thanks for the Help.

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