I don't know why this script won't work?
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local PlayerName = hit.Parent.Name --Player One-- local Gui = script.Parent.Parent.PlayersInMatchPart.PlayersInMatchGui if Gui.Player1.Taken.Value == 1 and Gui.Player1.Name.Value ~= PlayerName then Gui.Player1.Taken.Value = 2 print(PlayerName.userId) Gui.Player1.Name.Value = PlayerName end end end) end)
Error: Workspace.MatchMakingArea.MatchFinderPart.OnTouch:8: attempt to index field 'Name' (a string value)
Also when I print our the players Id it just says nil?
Because playerName is a string value, you assigned a string to it e.g "zombaScripts" at line3, if you want to get the userId then just assign the player object instead
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local Player = hit.Parent --Player One-- local Gui = script.Parent.Parent.PlayersInMatchPart.PlayersInMatchGui if Gui.Player1.Taken.Value == 1 and Gui.Player1.Name.Value ~= Player.Name then Gui.Player1.Taken.Value = 2 print(Player.userId) Gui.Player1.Name.Value = Player.Name end end end) end)