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

How do I make it to where when a player sits on the seat GUI pops up on their screen?

How do I make it to where when a player sits on the seat GUI pops up on their screen? This is as far as I've gotten knowing what I know at the moment.

player = game.Players:GetPlayerFromCharacter(script.Parent)

script.Parent.Touched:connect(function(hit)
	if player then
		
	end
end)

I don't know if this is all correct. Let me know what I should do and if you could, tell me what part(s) in scripting I should learn so next time when I want to do something like this I know exactly what to do. Thanks

1 answer

Try this it should work.

put = script.Parent.Input
s = script.Parent

bounce = false

function t(p)
if bounce == true then return end
bounce = true
	local h = p.Parent:findFirstChild("Humanoid")
		if h ~= nil then
			gui = put:GetChildren()
				for i=1, #gui do
					if gui[i].className == "ScreenGui" then
						x = gui[i]:clone()
						player = game.Players:GetPlayerFromCharacter(p.Parent)
							if player ~= nil then
								x.Parent = player.PlayerGui
							else
								print("No player found")
							end
					end
				end
		end
wait(1)
bounce = false
end

s.Touched:connect(t)

10 comments

0

When you say "bounce = false function t(p) if bounce == true then return end" What does that do? I'm confused.

0

It means if bounce is true duble check

0

Also 1) When you put "gui[i].className" What are the Brackets for? 2) When you say "for i=1, #gui do" What is the # for and what does it do? 3) The first variable you said "put = script.Parent.Input" What is Input and what is it for?

0

okay, first I messed up. If bounce is true end the script right there and go to the next variable. 1) This script was intended for a computer. 2) Its gust a variable nothing special. 3) as I said before this was ment for a computer

0

Edit what you dont want. Its just what I had

0

You make no sense to me. I was asking questions so I could understand what your writing, but I don't so can you please answer my questions? Also i'm a beginner Scripter if you don't already know and I need to know these things.

0

Make sure to put that script into the a seat

0

I will, but can you tell me what going on in the script so I know what's happening?

0

Okay. I designed this script for a computer. This will work without the computer, just place this script into a "seat" and that seat into whatever you want. Now for the questions, 1) That is saying once the player has sat in his seat the "ScreanGui" will start up. 2) By saying this we are telling the script to use gui 1.(Just for the specifics) 3) The input is the screen gui, for example your fi

0

for example your screenGUI is in input witch is in seat

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