If I am in this zone, I have effects, if I leave, then the effect is gone

Hello

  1. What do you want to achieve? I would like to know how to make a script that lets people have certain abilities in an area

  2. What is the issue? My scripting knowledge is kind of bad

  3. What solutions have you tried so far? I looked for free models, nothing works

Script

cooldown = false

script.Parent.Touched:Connect(function(hit)
	if hit and hit.Parent and hit.Parent.Humanoid and cooldown == false then
		cooldown = true
		-- what do I do?
		script.Parent.TouchEnded:Connect(function()
			cooldown = false
			Something:Destroy()
		end)
	end
end)

Specifically, I just want the fog to be nonexistent here

Any help would be appreciated

Try Region3.new Here’s a link to help you learn about it: Region3 | Roblox Creator Documentation

1 Like

Check out the ZonePlus library if you don’t mind using 3rd party libraries.

local Zone = require(game:GetService("ReplicatedStorage").Zone)
local container = workspace.doop
local zone = Zone.new(container)

zone.playerEntered:Connect(function(player)
	print(("%s entered the zone!"):format(player.Name))
end)

zone.playerExited:Connect(function(player)
	print(("%s exited the zone!"):format(player.Name))
end)

Never mind, did it!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.