Explanation
You've spelled Humanoid to Huamanoid. That's why it isn't appearing and the script isn't continuing from that line. If fixing it still doesn't work, here is the solution down below.
** Solution **
First of all, make sure that the part ( you want to touch for a GUI to appear) is named TouchPart for better referencing and to avoid confusion.
Also, make sure to insert a Remote Event into Replicated Storage as we'll be firing that to a client later on and make sure it's named TouchEvent.
That being done, remove the scripts that are dealing with the part's touch. Now, insert a script into ServerScriptService as it handles all the normal scripts.
The script in the ServerScriptService should be as follows:
game.Workspace.TouchPart.Touched:Connect(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
game.ReplicatedStorage.TouchEvent:FireClient( game.Players:GetPlayerFromCharacter(hit.Parent))
end
end)
Now, insert a local script inside the Screen GUI, not inside its descendant. The local script would be as follows.
game.ReplicatedStorage.TouchEvent.OnClientEvent:Connect(function()
script.Parent.Frame.Visible = not script.Parent.Frame.Visible
end)
^^ The reason I'm using not script.Parent.Frame.Visible is because of that whenever a player leaves the part, the GUI disappears which is really efficient if you ask me..
4 comments
It can't appear
You’d need to get your UI from the players side as anything changed in startergui won’t change for the player, it would just stay where it is.
So I should use a localscript?
Don't use local scripts as onTouch doesn't work and they only run on specific things..