✓ Accepted answer
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
local repStorage = game:GetService("ReplicatedStorage")
local Event = repStorage.GiveGuiOnTouch
brick.Touched:connect(function(p)
local h = p.Parent:FindFirstChild("Humanoid")
if h ~= nil then
local player = game.Players:GetPlayerFromCharacter(p.Parent)
Event:FireClient(player)
end
end)
LocalScript in StarterGui
This script waits when the Event:FireClient(player) activates it from the Brick touching!
local repStorage = game:GetService("ReplicatedStorage")
local Event = repStorage.GiveGuiOnTouch
local player = game.Players.LocalPlayer
Event.OnClientEvent:connect(function()
player.PlayerGui.ScreenGui.Frame.Visible = true
end)
LocalScrpt in a GUI button
This is just a button that disables visibility on click
script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.Visible = false
end)
2 comments
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.
Why are you only running this code when 'torso==nil ' ??