Why doesn't this script detect an attribute change?

I’ve attempted this, only to be met with the same result, unfortunately. But just to make sure, here’s the current script

Hitbox.Touched:Connect(function(player)
	local function Check()
		if Handle:GetAttribute("IsActivated") == true then
		Count += 1
		local Cast = workspace:Raycast(Handle.Position, Handle.CFrame.LookVector * 2)
		if Cast then
			if Cast.Instance.Name ~= AzureOre.Name then return end
		else
			return
		end
	end

	repeat task.wait(1) Check() until Count == 5
	OreTouchedEvent:FireServer(AzureOre)
	Count = 0
	end
end)

Your forgetting the end.

Hitbox.Touched:Connect(function(player)
	local function Check()
	    if Handle:GetAttribute("IsActivated") == true then
           Count += 1
			local Cast = workspace:Raycast(Handle.Position, Handle.CFrame.LookVector * 2)
			if Cast then
				if Cast.Instance.Name ~= AzureOre.Name then return end
			else
				return
			end
		end
	end

	repeat task.wait(1) Check() until Count == 5
	OreTouchedEvent:FireServer(AzureOre)
	Count = 0
	end
end)
1 Like

This actually works! Thank you for helping me!

1 Like

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