Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How To Make A GUI Show Up For One Character?

	function YouThought()
	wait(1)	
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true
	wait(2)
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false
	end
game.workspace.Obby3.SIKE.Touched:connect(YouThought)

As you see above, this script is suppose to make a Gui show up when someone touches a certain brick and dies. Well.

This LOCAL SCRIPT works fine but the thing is that whenever someone touches that brick instead of being visible to only that person who touched it, it's visible for everyone in the server and I believe that'd be kind of annoying to see when someone else touches it instead. Anyway, I just wanted to know how to make it where it ONLY shows up for the person who touched it and not everyone.

Oh and, Obby3 is a model....

1 answer

✓ Accepted answer

Use Players:GetPlayerFromCharacter on the player's model to find the player you want to change the GUI of, like so:

function YouThought(touched)
    local player = game.Players:GetPlayerFromCharacter(touched.Parent)
    if not player then return end

    wait(1) 
    player.PlayerGui.ScreenGui.Frame.Visible = true
    wait(2)
    player.PlayerGui.ScreenGui.Frame.Visible = false
end

game.workspace.Obby3.SIKE.Touched:connect(YouThought)

This discussion is preserved as it was. New answers, comments, and votes are closed.