The code works fine however it keeps spitting out this error in the console.
“Workspace.StreetTest.MainScript:6: attempt to index nil with 'PlayerGui”
How do I fix this?
Here is my code:
local name = 'test'
script.Parent.TouchEnded:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
wait(1)
local playerGui = player.PlayerGui
local streetText = playerGui.StreetName
local streetName = streetText.TextLabel
streetName.Text = name
end)