Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to make a few Gui frames visible on touched, why isn't it working?

Asked by
c5or 8
6 years ago

Inserted in a serverscript inside the brick

1script.Parent.Touched:connect(function(Hit)
2    local H = Hit.Parent:FindFirstChild("Humanoid")
3    if H then
4        local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
5        Player.PlayerGui.guiMain.frmBackground.Visible = true
6        Player.PlayerGui.guiMain.frmPrelims.Visible = true
7        Player.PlayerGui.guiMain.frmStep3.Visible = true
8    end
9end)

(I got this from the forums 4 years ago)

0
If the gui's are from startergui they will only exist on the client. Check the errors in output for more info. I suggest you use a localscript to edit any guis gullet 471 — 6y
0
I tried a localscript aswell, it didn't show any errors but also didn't work. c5or 8 — 6y
0
If there are no errors then it's either working (but not as intended) or not running. Try printing something on line 1 to see if it is. If it's not running it's either disabled or misplaced, check the wiki articles on script types to see where they can run. gullet 471 — 6y
0
Local script wont work because localscripts dot run is they are in the workspace and serverscripts cant access playergui, you have to use remoteEvents aazkao 787 — 6y
0
Alright, thanks c5or 8 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

This is how I would do your script I believe I did what you tried once and it didn't work but this might so try it.

1local h = hit.Parent:FindFirstChild("Humanoid")
2if h then
3local Pllayer = game.Players[hit.Parent.Name] -- This will see who is touching the part
4        Player.PlayerGui.guiMain.frmBackground.Visible = true
5        Player.PlayerGui.guiMain.frmPrelims.Visible = true
6        Player.PlayerGui.guiMain.frmStep3.Visible = true
7    end
8end)
0
"hit" in [hit.Parent.Name] is unknown global c5or 8 — 6y
0
do what the guy below did his most likely works I haven't tried this script in a year GameBoyOtaku 63 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Try this.

1script.Parent.Touched:connect(function(hit, player)
2    local h = hit.Parent:FindFirstChild("Humanoid")
3    if h then
4        local PlayerGui = player.PlayerGui
5        PlayerGui.guiMain.frmBackground.Visible = true
6        PlayerGui.guiMain.frmPrelims.Visible = true
7        PlayerGui.guiMain.frmStep3.Visible = true
8    end
9end)
0
Doesn't work, doesn't even show any errors. (in studio or in-game) c5or 8 — 6y
0
Oh.. Can you try using a local script for me? Put in local player = game.Players.LocalPlayer and local playergui = player.PlayerGui User#22722 20 — 6y
0
Sure, sec c5or 8 — 6y
0
Still doesn't work and doesn't show any error logs, is there anywhere else in the Explorer I can put the script? c5or 8 — 6y
View all comments (2 more)
0
Is the frame in a screengui? Are the tick boxes checked visible? Also depending on how you want the player to interact with with the gui, ABK2017 406 — 6y
0
Certain events aren’t available to a frame or textlabel the way they are with say a text button. ABK2017 406 — 6y

Answer this question