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

Gui not appearing when brick touched?

Asked by 8 years ago
01GUI = game.ReplicatedStorage.Radar.radar
02local Part = script.Parent
03 
04Part.Touched:connect(function(HIT)
05 local H = HIT.Parent:FindFirstChild("Humanoid")
06 if H then
07  local Player = game.Players:GetPlayerFromCharacter(HIT.Parent)
08  if Player == game.Players.LocalPlayer then
09    game.PlayerGui.Radar.radar.Visible = true
10    -- Radar is a screen GUI
11    -- radar is a frame
12end
13 end
14end)?
0
This is in a local script BTW User#17125 0 — 8y

3 answers

Log in to vote
0
Answered by 8 years ago

Okay, I'm pretty sure this will work, but fix your GetPlayerFromCharacter() to look like this:

1local Player = game.Players:GetPlayerFromCharacter(HIT.Parent.Name)
0
Im sorry, but this doesn't work either. I am really stumped here. User#17125 0 — 8y
0
The GetPlayerFromCharacter() isn't working for me too. Maybe somethings wrong with it. SimpleFlame 255 — 8y
0
GetPlayerFromCharacter() requires an object, not a string Netflixy 126 — 8y
Ad
Log in to vote
0
Answered by
halwa 11
7 years ago
01script.Parent.Touched:connect(function(hit)
02if hit.Parent.Humanoid then
03    local Character = hit.Parent
04    local Player = game.Players:GetPlayerFromCharacter(Character)
05    local PlayerGui = Player.PlayerGui
06    local Gui = PlayerGui.Radar
07    local Frame = Gui.radar
08    Frame.Visible = true
09end
10end

Hope this helps

Log in to vote
-1
Answered by 8 years ago

If your trying to make a Frame visible then just access the PlayerGui;

Make sure this is a script, not local script

1local part = script.Parent
2 
3part.Touched:Connect(function(H)
4    local pg = H.Parent:WaitForChild("PlayerGui")
5    local frame = pg:WaitForChild("Radar").radar
6    wait()
7    radar.Visible = true
8end)

You don't need some stuff,

if this helped please accept answer :D

0
PlayerGui is a child of the player, not the Character (H.Parent). Azarth 3141 — 8y
0
This script doesn't work. User#17125 0 — 8y

Answer this question