0 views0 copies0 likes

Touch Damage Zone for Obstacle Courses

Universal script

Copy it, then test it in your own Studio place.

Combat & movement Verified

Script code

11 lines ยท 0.4 KB
Download
local tile = workspace:WaitForChild("HazardTile")local last = setmetatable({}, {__mode = "k"})tile.Touched:Connect(function(hit)	local model = hit:FindFirstAncestorOfClass("Model")	local humanoid = model and model:FindFirstChildOfClass("Humanoid")	if not humanoid or humanoid.Health <= 0 then return end	local time = os.clock()	if last[humanoid] and time - last[humanoid] < 1 then return end	last[humanoid] = time	humanoid:TakeDamage(18)end)

About this script

Use an anchored part named HazardTile to teach hazard feedback in your own obby. Contact deals 18 damage once per character per second while allowing Roblox ForceFields to protect fresh spawns. The server validates a living Humanoid and ignores decorative parts. Color the tile clearly, leave a way around it, and test that multiple limb contacts do not drain health instantly.

Comments

Share what works, ask questions, or report an issue.

0

Log in to leave a comment.

No comments yet

Be the first to share your thoughts!

Raw Luau source

local tile = workspace:WaitForChild("HazardTile")
local last = setmetatable({}, {__mode = "k"})
tile.Touched:Connect(function(hit)
	local model = hit:FindFirstAncestorOfClass("Model")
	local humanoid = model and model:FindFirstChildOfClass("Humanoid")
	if not humanoid or humanoid.Health <= 0 then return end
	local time = os.clock()
	if last[humanoid] and time - last[humanoid] < 1 then return end
	last[humanoid] = time
	humanoid:TakeDamage(18)
end)