I have a script that does what I need it to, however after it executes once, I need it to be disabled for the person that ran the script. Does anyone have any examples or reference links for a starting point?
I was able to get some help on this on the Roblox Discord.
Essentially, what you need to do to get it working is have the block have a detector to detect what is touching it and who is touching it. Also add a delay to the top.
Script 1: (ServerScript)
--Ensure this is the child of the part you want to detect local part = script.Parent -- Part the will activate when touched local last = 0 local delay = 1000 --in seconds part.Touched:Connect(function(hit) if tick() - last > delay then last = tick() if hit.Parent:FindFirstChildOfClass("Humanoid") ~= nil then -- If there is a humanoid in the parent of what touched the part local char = hit.Parent -- The Character of the player --if the arm touches it, hit is the arm and parent is the arm's parent local player = game.Players:GetPlayerFromCharacter(char) -- This gets the player in game.Players by getting the name from its character local playergui = player.PlayerGui --Where all gui are located into the player local gui = playergui.ScreenGui.ProgressBar.Config.Progress gui.Value = gui.Value + 0.005 -- Adds 0.005 to the value end end end)
Script 2, to disable it: (LocalScript)
--Ensure this is is the child of the same script as above. You should also add a detector to ensure it's only being disabled when the parent part is touched. local progressScript = script.Parent.Script progressScript.Disabled = true wait(600) progressScript.Disabled = false