I cannot figure out how to tell a local script that a certain block was touched, and trigger an event to open up a gui. No need for a huge block of code, just give me a short run down of how I should do it. Thanks in advance!
✓ ANSWER ACCEPTED
Help telling a local script that a block was touched?
1 answer
✓ Accepted answer
Well, i'm not sure what you mean by this, do you mean telling the localscript what block the character touched, or having a preset block with a touch event telling the localscript it was touched?
-- Localscript
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
local player = game.Players.LocalPlayer
local character = player.Character
local block = game:GetService'Workspace':WaitForChild("Part")
local gui = script.Parent -- Put localscript inside gui
gui.Visible = false
local debounce = false
block.Touched:connect(function(p)
if debounce then return end
debounce = true
local humanoid = p.Parent:FindFirstChild'Humanoid'
if humanoid and p.Parent == character then
gui.Visible = true
end
debounce = false
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
I mean a preset block with a touch event. Sorry. And this is a singleplayer game as well. If that helps
Well if that's what you mean, then the above script should work perfectly, just parent it inside the gui
K thanks!