This script is based in a localscipt within a player's GUI (which does not reset upon respawn, if that matter).
The script detects if the localplayer's torso has touched a particular brick and then displays the GUI. It works, but once the player has died/respawned once or more, it no longer works. Output has given me nothing.
Here's the script:
local gui = script.Parent local torso = game.Players.LocalPlayer.Character:WaitForChild("Torso") torso.Touched:connect(function(hit) if hit.Name == "counter" then gui.Enabled = true end end)
You'll want to use remote events for this matter. Use a server script and a local script. The server script would be if you touch the brick then you would fire the server and on the local script you would do retrieve the remote events from the server script and make it do what you want. Example:
--//Server script local brick = script.Parent --brick is in workspace local remoteEvent = game.ReplicatedStorage.RemoteEvent --where the remote event is located
brick.Touched:Connect(function(hit) --when the player touches the brick local plr = hit.Parent:GetPlayerFromCharacter() -getting the player from character local hum = hit.Parent:FindFirstChild("Humanoid") --finds the humanoid if hum ~= nil then --checks to see if the object touched has a humanoid remoteEvent:FireServer(plr) --fires remote event end)
--//Local script local remoteEvent = game.ReplicatedStorage.RemoteEvent --where the remote event is located local screenGui = script --wherever the gui is located
remoteEvent.OnServcerEvent:Connect(function(plr) --retrieve data from fired server screenGui.Parent = plr.PlayerGui --parents the screenGui to PlayerGui
**I did not try it on studio yet, but go ahead see if it works and if it doesn't just hmu and I can further help you :)