Here's my script, in the print(Player) I get my player name so shouldn't it work?
local Debounce = false script.Parent.Touched:Connect(function(Object) if Object.Parent:FindFirstChild("Humanoid") then local player = Object.Parent print(player) game.ReplicatedStorage.JoinTeam:FireClient(player) end end)
What you need is :GetPlayerFromCharacter
since FireClient takes a player, not the object that touched the part (which is what Object.Parent
is)
So:
local Debounce = false script.Parent.Touched:Connect(function(Object) if Object.Parent:FindFirstChild("Humanoid") then local player = game:GetService("Players"):GetPlayerFromCharacter(Object.Parent) -- This is the line that matters. :GetPlayerFromObject is a member of the Players service. print(player) game.ReplicatedStorage.JoinTeam:FireClient(player) end end)