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 7 years ago
GUI = game.ReplicatedStorage.Radar.radar
local Part = script.Parent

Part.Touched:connect(function(HIT)
 local H = HIT.Parent:FindFirstChild("Humanoid")
 if H then
  local Player = game.Players:GetPlayerFromCharacter(HIT.Parent)
  if Player == game.Players.LocalPlayer then
    game.PlayerGui.Radar.radar.Visible = true
    -- Radar is a screen GUI
    -- radar is a frame
end
 end
end)?
0
This is in a local script BTW User#17125 0 — 7y

3 answers

Log in to vote
0
Answered by 7 years ago

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

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

Hope this helps

Log in to vote
-1
Answered by 7 years ago

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

Make sure this is a script, not local script

local part = script.Parent

part.Touched:Connect(function(H)
    local pg = H.Parent:WaitForChild("PlayerGui")
    local frame = pg:WaitForChild("Radar").radar
    wait()
    radar.Visible = true
end)

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 — 7y
0
This script doesn't work. User#17125 0 — 7y

Answer this question