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

A GUI won't get visible due to filtering enabled?

Asked by
skyab12 25
7 years ago

So I made a door and if you touch it without filtering enabled then a GUI will pop up. But with filtering enabled it doesn't work anymore

This is the door script:

function onTouched(hit) local torso = hit.Parent:findFirstChild("Torso") if torso==nil then X = game.Players:playerFromCharacter(hit.Parent) X.PlayerGui.ScreenGui.QuestionS.Visible = true end end

script.Parent.Touched:connect(onTouched)

GUI script in StarterGui:

script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Visible = false end)

0
You'll have to use remote events. The touched event only works on the server and GUI editing only works on the client with FE. GoldenPhysics 474 — 7y
0
Why are you only running this code when 'torso==nil ' ?? User#5423 17 — 7y

1 answer

Log in to vote
1
Answered by
Bulvyte 388 Moderation Voter
7 years ago
Edited 7 years ago

How everything should look for you: http://prntscr.com/c2rcfu

Put a serverscript into the brick, put a GiveGuiOnTouch RemoteEvent in the ReplicatedStorage Put a LocalScript into StarterGui and make GUIS exactly like this on the screenshot or change everything in the script how u like.

ServerScript in a Brick

This script has to be in the Part that when u touch, the script fires your client from Server > to LocalScript.

local brick = script.Parent --where the brick is
local repStorage = game:GetService("ReplicatedStorage") --Gets replicated storage
local Event = repStorage.GiveGuiOnTouch --where the event is

brick.Touched:connect(function(p)    -- when our brick is touched
    local h = p.Parent:FindFirstChild("Humanoid") -- find humanoid
    if h ~= nil then --if the humanoid exists
        local player = game.Players:GetPlayerFromCharacter(p.Parent) -- get the player from character
        Event:FireClient(player) -- fire the client
    end
end)

LocalScript in StarterGui

This script waits when the Event:FireClient(player) activates it from the Brick touching!

local repStorage = game:GetService("ReplicatedStorage") -- get replicatedstorage
local Event = repStorage.GiveGuiOnTouch -- where the event is
local player = game.Players.LocalPlayer -- player variable

Event.OnClientEvent:connect(function() --listens the event when FireClient is fired it will activate
    player.PlayerGui.ScreenGui.Frame.Visible = true -- makes your GUI visible.
end)

LocalScrpt in a GUI button

This is just a button that disables visibility on click

script.Parent.MouseButton1Click:connect(function() --when the gui's button clicked
    script.Parent.Parent.Visible = false -- make it invisible!
end)
0
This isnt working??? BADABOO2016 3 — 6y
Ad

Answer this question