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

How do you make an Ontouched event effect GUIs?

I am wanting it so when the player touches a certain part, it will effect a GUI. (In my case, change the transparency of the GUI.)

2 comments

0

then put an ontouched in a part in a script and make it so the gui changes transparency

0

lol

2 answers

When the player touched it we want it to activate the GUI so use a Local Script and then do this:

workspace.NameOfPart.Touched:Connect(function()
local plrname = game.Players.LocalPlayer.Name

and then activate the GUI:

game.Players[plrname]:FindFirstChild("Name of  GUI").FrameTransparency = --Insert number

change names and stuff like that But not the plrname!!

I hope it helped!

well first you want to detect when a player hits the part

script.Parent.Touched:Connect(function(part)
local h = part.Parent:FindFirstChild("Humanoid")
if h ~= nil then
--do anything
end
end)

and you can replace the "do anything" part with anything, in this case you want a gui to pop up

replace "do anything" with this:

game.Players[part.Partent.Name].PlayerGui.ScreenGui

and now you are in the screengui of the player do whatever you want then

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