Minor part.Touched issue while changing Gui text to player name

I’ve been trying to set the “complete” gui textlabel in the startergui to visible and text = player.name concatinated with “has climbed the stairs” but my code isn’t working for some reason,here’s my code

    script.Parent.Touched:Connect(function(hit)
    
   game.StarterGui.ScreenGui.complete.Text = hit.parent.name .. " has climbed the 

Unclimbable Stairs!!"

    game.StarterGui.ScreenGui.complete.Visible=true

    game.StarterGui.ScreenGui.complete.inviser.Disabled=false

    wait(3) 

      game.StarterGui.ScreenGui.complete.Visible=false
 
end)

The script “inviser” that is enabled

script.Disabled=true

script.Parent.TouchTap:Connect(function()

script.Parent.Visible=false

end)

you can’t mention starter gui, you have to get the player and the player gui:

 script.Parent.Touched:Connect(function(hit)
    plr = hit.Parent:GetPlayerFromCharacter()
   plr:WaitForChild("PlayerGui").ScreenGui.complete.Text = hit.parent.name .. " has climbed the 

Unclimbable Stairs!!"

    game.StarterGui.ScreenGui.complete.Visible=true

    game.StarterGui.ScreenGui.complete.inviser.Disabled=false

    wait(3) 

      game.StarterGui.ScreenGui.complete.Visible=false
 
end)

or you can do it straight from the starter gui(parent to starter gui)

part = the part that is touched

part.Touched:Connect(function()
    
   script.Parent.ScreenGui.complete.Text = hit.parent.name .. " has climbed the 

Unclimbable Stairs!!"

    game.StarterGui.ScreenGui.complete.Visible=true

    script.Parent.ScreenGui.complete.inviser.Disabled=false

    wait(3) 

      script.Parent.ScreenGui.complete.Visible=false
 
end)
1 Like

nope it doesnt work, no output at all

the script runs but nothing changes in the text

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local plr = workspace[hit.Parent.Name] 
        local player = game.Players:GetPlayerFromCharacter(plr) 

      local g =  plr:WaitForChild("PlayerGui")
    g.ScreenGui.complete.Text = plr.. " has climbed the Unclimbable Stairs!!"

    g.ScreenGui.complete.Visible = true

    g.ScreenGui.complete.inviser.Disabled = false

    wait(3.2) 

      g.ScreenGui.complete.Visible=false
      end
end)

You are identifying local g = plr:WaitForChild("PlayerGui") when it should be local g = player:WaitForChild("PlayerGui")

1 Like

Use my exact script with the humanoid check

I got the solution , I had to loop ipairs through players:GetPlayer()
for _,looped player etc etc. on another post, but thanks anyways

Please mark it as solution if you fixed it.

2 Likes

Solved here, sorry for any inconvenience

1 Like