What's the best option for programming interactive Parts/Zones?

Heya!

So I’ve been trying to create an interactive part where the player can step on, and it’ll reveal a GUI – and when they step off of it, the GUI will close. Though, I don’t have the GUI elements at the moment, so I’m trying to apply a blur effect as a background (locally).

Though, I am having second thoughts on how I am going about this:

I have tried creating a local script and placing it within the ServerScriptServer to try and make the blur happen locally to the player, as so:

local Part = workspace:FindFirstChild("Updates_Interact")
local debounce = false

Part.Touched:Connect(function(hit)
	if not debounce then
		
		
		debounce = true
		
		if hit.Parent:FindFirstChild("Humanoid") then
			local blurEffect = Instance.new("BlurEffect")
			--change some properties of the blurEffect if needed..
			blurEffect.Name = "BackgroundBlur"
			blurEffect.Enabled = true
			blurEffect.Parent = game:GetService("Lighting")
			
			wait(2) -- test
			blurEffect:Destroy() --This is just a test
			
		end
		
		debounce = false
	end
end)

Ultimately, the script did not work, which led me to the question; would magnitude/region3 work better with this? Because I’m not sure how I would detect when the player steps off the part through Touched functions.

If so, how would I go about it? I’ve watched a couple of videos on Region3 and its hard to find one where it explains thoroughly at what it does.

1 Like

Your local script doesn’t work because local scripts won’t run inside ServerScriptService. They need to be inside the player object, or the character. In cases I’ve done similar things, I’ve usually went with magnitude checks because I have had issues in the past with the .TouchEnded event not always firing.

3 Likes